Browse Source

Merge pull request #3285 in DESIGN/design from feature/10.0 to research/10.0

* commit '0d9fe11c315ff19ccd44c5d2153d73613cde4be7':
  CHART-15837  字段汇总方式控件修改
  REPORT-32210 release传一份
  REPORT-46575【10.0.13冒烟】界面组件中硬编码的字体更改为统一UI字体
  REPORT-46353 jdk8-插入普通文本图标变模糊了 【问题原因】之前的获取系统scale的方法有点问题,如果是jdk8,mac下会获取到1.0,然后图标就没有jdk11下获取成2.0那么清晰 【改动思路】直接判断下是不是retina显示,如果是的,返回2.0的scale;另外发现定义数据连接的svg图片漏传了,也传一下
  地图富文本面板适配
  完善词云初始化富文本参数
  词云富文本新增字段适配
  散点图富文本新增字段适配
  富文本编辑器增加字段名的类属性
  调整富文本参数更新的位置
  补充新增字段富文本中的交互
  完善新增字段更新
  获取数据集字段
  完善界面
  调整代码结构
  处理新的富文本界面交互
  开发富文本字段界面
research/10.0
superman 4 years ago
parent
commit
6517d5bda6
  1. 7
      designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java
  2. 22
      designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java
  3. 123
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  4. 7
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  5. 22
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java
  6. 6
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  7. 5
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  8. 10
      designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java
  9. 6
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  10. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java
  11. 102
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java
  12. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  13. 191
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
  14. 169
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  15. 79
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java
  16. 141
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  17. 382
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  18. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java
  19. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java
  20. 195
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  21. 8
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java
  22. 95
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java
  23. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java
  24. 41
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java
  25. 32
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java
  26. 31
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java
  27. 9
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java
  28. 93
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java
  29. 110
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java
  30. 41
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java
  31. 55
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java
  32. 31
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  33. 1
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  34. 13
      designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java
  35. 435
      designer-form/src/main/java/com/fr/design/designer/creator/XButton.java
  36. 70
      designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java
  37. 10
      designer-realize/src/main/java/com/fr/design/condition/FontPane.java
  38. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  39. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java
  40. 18
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  41. 5
      designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java
  42. 4
      designer-realize/src/main/java/com/fr/design/report/RichTextPane.java
  43. 68
      designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java
  44. 12
      designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java
  45. 4
      designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

7
designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java

@ -1,5 +1,6 @@
package com.fr.base.svg;
import com.bulenkov.iconloader.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
@ -77,6 +78,10 @@ public class SystemScaleUtils {
* @return
*/
public static float sysScale() {
// 如果检测到是retina,直接返回2
if (UIUtil.isRetina()) {
return 2.0f;
}
float scale = 1.0f;
// 先判断是否支持高清,不支持代表此时是Windows + jdk8 的设计器,返回的scale值为1.0
if (isJreHiDPIEnabled()) {
@ -86,7 +91,7 @@ public class SystemScaleUtils {
// 获取图形配置对象
GraphicsConfiguration configuration = graphicsDevice.getDefaultConfiguration();
if (configuration != null && configuration.getDevice().getType() != GraphicsDevice.TYPE_PRINTER) {
// 获取屏幕缩放率,mac下固定为2,Windows+jdk11则将得到用户设置的dpi值
// 获取屏幕缩放率,Windows+jdk11环境下会得到用户设置的dpi值
scale = (float) configuration.getDefaultTransform().getScaleX();
}
}

22
designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java

@ -1,12 +1,14 @@
package com.fr.design.gui.date;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.DesignUtils;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.*;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
@ -21,7 +23,7 @@ public class CalendarNumberField extends UINumberField {
private static final int NUM_TEN = 10;
public CalendarNumberField( double maxValue) {
public CalendarNumberField(double maxValue) {
super(2, 0, 0, maxValue);
this.setBorderPainted(false);
addFocusListener(new FocusAdapter() {
@ -30,12 +32,12 @@ public class CalendarNumberField extends UINumberField {
setValue(getIntValue());
}
});
this.setFont(new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"),0,12));
this.setFont(DesignUtils.getDefaultGUIFont());
}
public void setValue(int value) {
if (value < 0) {
value = (int)getMaxValue();
value = (int) getMaxValue();
}
if (value > getMaxValue()) {
value = 0;
@ -43,7 +45,7 @@ public class CalendarNumberField extends UINumberField {
this.setText(getValueText(value));
}
public int getIntValue () {
public int getIntValue() {
if (this.getText().length() == 0) {
return 0;
}
@ -61,8 +63,7 @@ public class CalendarNumberField extends UINumberField {
}
public void setFieldDocument(){
public void setFieldDocument() {
setDocument(new NumberDocument());
}
@ -89,14 +90,15 @@ public class CalendarNumberField extends UINumberField {
super.insertString(offset, s, a);
}
private boolean isOverMaxOrMinValue( String strNew) {
return (Double.parseDouble(strNew)<getMinValue() || Double.parseDouble(strNew)>getMaxValue());
private boolean isOverMaxOrMinValue(String strNew) {
return (Double.parseDouble(strNew) < getMinValue() || Double.parseDouble(strNew) > getMaxValue());
}
}
public Dimension getPreferredSize() {
return new Dimension(24, 11);
}
public boolean shouldResponseChangeListener() {
return false;
}

123
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -7,8 +7,8 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
@ -45,8 +45,8 @@ import java.util.Calendar;
import java.util.Date;
public class UICalendarPanel extends JPanel {
private static final Font FONT_SONG = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"),0,12);
private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"),0,12);
private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(12);
private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, 12);
private static final int WEEKDAY_COUNT = 7;
private static final int TOTAL_DAYS_COUNT = 42;
@ -108,13 +108,13 @@ public class UICalendarPanel extends JPanel {
}
// << < yyyy/MM/dd > >>
private JPanel createNorthPane () {
private JPanel createNorthPane() {
JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
pNorth.setBackground(new Color(0xFFFFFF));
pNorth.setPreferredSize(new Dimension(1, 22));
pNorth.add(Box.createHorizontalStrut(5));
pNorth.add(createSkipButton(Calendar.YEAR, -1 , new Icon[] {
pNorth.add(createSkipButton(Calendar.YEAR, -1, new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_hover.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_click.png")
@ -130,7 +130,7 @@ public class UICalendarPanel extends JPanel {
monthLabel = new UILabel("", UILabel.CENTER);
monthLabel.setBackground(new Color(0xFFFFFF));
monthLabel.setForeground(new Color(0x000000));
monthLabel.setFont(FONT_SONG);
monthLabel.setFont(FONT_UI);
pNorth.add(Box.createHorizontalGlue());
pNorth.add(monthLabel);
pNorth.add(Box.createHorizontalGlue());
@ -144,7 +144,7 @@ public class UICalendarPanel extends JPanel {
monthPlus.setHorizontalAlignment(SwingConstants.RIGHT);
pNorth.add(monthPlus);
pNorth.add(Box.createHorizontalStrut(11));
pNorth.add(createSkipButton(Calendar.YEAR, 1 , new Icon[] {
pNorth.add(createSkipButton(Calendar.YEAR, 1, new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/calender/year_add.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_add_hover.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_add_click.png")
@ -161,9 +161,9 @@ public class UICalendarPanel extends JPanel {
pWeeks.setPreferredSize(new Dimension(216, 22));
pWeeks.setBackground(new Color(0xFFFFFF));
pWeeks.setOpaque(true);
String[] strWeeks = new String[] {StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat")
String[] strWeeks = new String[]{StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat")
};
for (int i = 1; i <= WEEKDAY_COUNT; i++) {
UILabel label = new UILabel();
@ -197,32 +197,32 @@ public class UICalendarPanel extends JPanel {
return pCenter;
}
private JPanel createSouthPane () {
private JPanel createSouthPane() {
JPanel sPane = new JPanel();
sPane.setPreferredSize(new Dimension(216, 30));
sPane.setBackground(Color.WHITE);
sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6));
UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":");
timeLabel.setBorder(BorderFactory.createEmptyBorder(0,9,0,5));
timeLabel.setFont(FONT_SONG);
timeLabel.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 5));
timeLabel.setFont(FONT_UI);
sPane.add(timeLabel);
hms = new HMSPane();
sPane.add(hms);
UILabel gap = new UILabel();
gap.setPreferredSize(new Dimension(26,1));
gap.setPreferredSize(new Dimension(26, 1));
sPane.add(gap);
UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) {
public Dimension getPreferredSize() {
return new Dimension(32,18);
return new Dimension(32, 18);
}
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
}
};
okButton.setFont(FONT_SONG);
okButton.setFont(FONT_UI);
okButton.setVerticalAlignment(SwingConstants.CENTER);
okButton.addActionListener(new ActionListener() {
@ -248,11 +248,12 @@ public class UICalendarPanel extends JPanel {
/**
* 创建上一月,下一月,上一年,下一年"按钮"
* @param field int
*
* @param field int
* @param amount int
* @return UILabel
*/
protected UILabel createSkipButton(final int field, final int amount,final Icon[] icons) {
protected UILabel createSkipButton(final int field, final int amount, final Icon[] icons) {
if (icons.length != 3) {
return new UILabel();
}
@ -274,11 +275,11 @@ public class UICalendarPanel extends JPanel {
}
public void mouseEntered(MouseEvent e) {
label.setIcon(icons[1]);
label.setIcon(icons[1]);
}
public void mouseExited(MouseEvent e) {
label.setIcon(icons[0]);
label.setIcon(icons[0]);
}
public void mousePressed(MouseEvent e) {
@ -311,7 +312,7 @@ public class UICalendarPanel extends JPanel {
gp.setBorder(null);
UIDayLabel label = new UIDayLabel(setupCalendar.getTime());
label.setHorizontalAlignment(SwingConstants.RIGHT);
label.setBorder(BorderFactory.createEmptyBorder(0,0,0,9));
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 9));
label.addMouseListener(dayBttListener);
if ("1".equals(label.getText())) {
isCurrentMonth = !isCurrentMonth;
@ -328,7 +329,7 @@ public class UICalendarPanel extends JPanel {
days.setSelectedIndex(i);
this.selectedDate = label.getDate();
this.calendar.setTime(this.selectedDate);
}else {
} else {
gp.add(label, BorderLayout.CENTER);
days.add(gp);
}
@ -337,7 +338,7 @@ public class UICalendarPanel extends JPanel {
}
public void updateHMS() {
if (hms != null){
if (hms != null) {
hms.populate(this.calendar);
hms.validate();
}
@ -388,9 +389,9 @@ public class UICalendarPanel extends JPanel {
public void mousePressed(MouseEvent e) {
if (isEnabled()) {
UIDayLabel com = (UIDayLabel) e.getComponent();
GradientPane gp = (GradientPane)com.getParent();
GradientPane gp = (GradientPane) com.getParent();
if (days.selectedIndex != -1) {
((GradientPane)days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM));
((GradientPane) days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM));
}
gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM));
days.setSelectedIndex(gp.getIndex());
@ -413,7 +414,7 @@ public class UICalendarPanel extends JPanel {
public void mouseEntered(MouseEvent e) {
if (isEnabled()) {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane)com.getParent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() == days.selectedIndex) {
return;
}
@ -426,7 +427,7 @@ public class UICalendarPanel extends JPanel {
public void mouseExited(MouseEvent e) {
if (isEnabled()) {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane)com.getParent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() != days.selectedIndex) {
gp.setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM));
}
@ -489,7 +490,7 @@ public class UICalendarPanel extends JPanel {
this.isGradientBackground = isGradientBackground;
}
public void paint(Graphics g){
public void paint(Graphics g) {
super.paint(g);
if (isGradientBackground && gradientBackground != null) {
gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight()));
@ -509,7 +510,7 @@ public class UICalendarPanel extends JPanel {
this.index = i;
}
public int getIndex () {
public int getIndex() {
return this.index;
}
@ -530,12 +531,12 @@ public class UICalendarPanel extends JPanel {
public DayPane() {
floateIndex = -1;
selectedIndex = -1;
this.setLayout(new GridLayout(6,7,1,1));
this.setLayout(new GridLayout(6, 7, 1, 1));
this.setBackground(new Color(0xFFFFFF));
this.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(0xDADADA)));
}
public void paint (Graphics g) {
public void paint(Graphics g) {
super.paint(g);
int width = 31;
int height = 19;
@ -543,11 +544,11 @@ public class UICalendarPanel extends JPanel {
g.setColor(new Color(0xDADADA));
int start_x = 30;
int start_y = 19;
for (int i = 0; i < 6; i ++) {
for (int i = 0; i < 6; i++) {
g.drawLine(start_x, 0, start_x, getHeight());
start_x += width;
}
for (int i = 0; i < 5; i ++){
for (int i = 0; i < 5; i++) {
g.drawLine(0, start_y, getWidth(), start_y);
start_y += height;
}
@ -558,25 +559,25 @@ public class UICalendarPanel extends JPanel {
}
if (selectedIndex > -1) {
g.setColor(selectedColor);
paintChindPane(g,selectedIndex);
paintChindPane(g, selectedIndex);
}
g.setColor(oldColor);
}
private void paintChindPane(Graphics g, int index) {
if (index%7 == 0 ) {
int y1 = index/7*19;
g.drawLine(0,y1,30,y1);
g.drawLine(0,y1 + 19, 30, y1 +19);
g.drawLine(30, y1, 30 ,y1 + 19);
}else if (index%7 == 6) {
int y1 = index/7*19;
g.drawLine(185,y1,216,y1);
g.drawLine(185,y1 + 19, 216, y1 +19);
g.drawLine(185, y1, 185 ,y1 + 19);
if (index % 7 == 0) {
int y1 = index / 7 * 19;
g.drawLine(0, y1, 30, y1);
g.drawLine(0, y1 + 19, 30, y1 + 19);
g.drawLine(30, y1, 30, y1 + 19);
} else if (index % 7 == 6) {
int y1 = index / 7 * 19;
g.drawLine(185, y1, 216, y1);
g.drawLine(185, y1 + 19, 216, y1 + 19);
g.drawLine(185, y1, 185, y1 + 19);
} else {
int x1 = index%7*31 -1;
int y1 = index/7*19;
int x1 = index % 7 * 31 - 1;
int y1 = index / 7 * 19;
g.drawRect(x1, y1, 31, 19);
}
}
@ -599,7 +600,7 @@ public class UICalendarPanel extends JPanel {
}
private class HMSPane extends JPanel{
private class HMSPane extends JPanel {
private boolean isRolOver;
private UIButton preButton;
private UIButton nextButton;
@ -608,7 +609,7 @@ public class UICalendarPanel extends JPanel {
private CalendarNumberField sField;
private CalendarNumberField selectedNumberField;
public HMSPane () {
public HMSPane() {
this.setPreferredSize(new Dimension(101, 18));
this.setLayout(new BorderLayout(0, 0));
this.setBackground(null);
@ -633,7 +634,7 @@ public class UICalendarPanel extends JPanel {
}
private void initComponents() {
JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT,0,2));
JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2));
jp.setBackground(null);
jp.setBorder(null);
@ -649,13 +650,13 @@ public class UICalendarPanel extends JPanel {
jp.add(sField);
this.add(jp, BorderLayout.CENTER);
preButton = new UIButton(UIConstants.ARROW_UP_ICON){
preButton = new UIButton(UIConstants.ARROW_UP_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
};
preButton.setRoundBorder(true, Constants.LEFT);
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON){
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
@ -673,7 +674,7 @@ public class UICalendarPanel extends JPanel {
MouseAdapter backgroundAdapter = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
HMSPane.this.selectedNumberField = (CalendarNumberField)e.getComponent();
HMSPane.this.selectedNumberField = (CalendarNumberField) e.getComponent();
}
@Override
@ -710,17 +711,17 @@ public class UICalendarPanel extends JPanel {
});
}
private UILabel createGapLabel () {
private UILabel createGapLabel() {
UILabel uiLabel = new UILabel(":");
uiLabel.setHorizontalAlignment(SwingConstants.CENTER);
uiLabel.setBackground(null);
uiLabel.setBorder(null);
uiLabel.setPreferredSize(new Dimension(6,10));
uiLabel.setPreferredSize(new Dimension(6, 10));
return uiLabel;
}
public Insets getInsets() {
return new Insets(1,3,1,0);
return new Insets(1, 3, 1, 0);
}
public void paint(Graphics g) {
@ -729,7 +730,7 @@ public class UICalendarPanel extends JPanel {
}
public void paintBorder(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
Graphics2D g2d = (Graphics2D) g;
if (isRolOver) {
Shape shape = new RoundRectangle2D.Double(1, 1, 86, 15, UIConstants.ARC, UIConstants.ARC);
GUIPaintUtils.paintBorderShadow(g2d, 3, shape, UIConstants.HOVER_BLUE, Color.WHITE);
@ -738,7 +739,7 @@ public class UICalendarPanel extends JPanel {
}
}
public void populate(Calendar calendar){
public void populate(Calendar calendar) {
this.hField.setValue(calendar.get(Calendar.HOUR_OF_DAY));
this.mField.setValue(calendar.get(Calendar.MINUTE));
this.sField.setValue(calendar.get(Calendar.SECOND));
@ -751,15 +752,15 @@ public class UICalendarPanel extends JPanel {
}
}
public static void main(String[] args){
public static void main(String[] args) {
JFrame frame = new JFrame();
UICalendarPanel calendarPanel = new UICalendarPanel();
final UITextField field = new UITextField();
field.setPreferredSize(new Dimension(120, 25));
calendarPanel.addDateChangeListener(new ChangeListener(){
public void stateChanged(ChangeEvent e){
Date selectedDate = (Date)e.getSource();
calendarPanel.addDateChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
Date selectedDate = (Date) e.getSource();
SimpleDateFormat f = new SimpleDateFormat("yyyy/MM/dd");
field.setText(f.format(selectedDate));
}

7
designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java

@ -1,14 +1,13 @@
package com.fr.design.gui.date;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import java.awt.Dimension;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.Date;
public class UIDayLabel extends UILabel {
private Date date = null;
@ -28,13 +27,13 @@ public class UIDayLabel extends UILabel {
public UIDayLabel(Date date, boolean isSmallLabel) {
setHorizontalAlignment(UILabel.CENTER);
setFont(new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"), 0, 12));
setFont(DesignUtils.getDefaultGUIFont());
this.date = date;
setPreferredSize(new Dimension(30, 18));
if (isSmallLabel) {
setText(dayFormat.format(date));
} else {
setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Today")+":" + dateFormat.format(new Date()));
setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Today") + ":" + dateFormat.format(new Date()));
}
}

22
designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java

@ -1,16 +1,18 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.filetree.IOFileNodeFilter;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -32,7 +34,7 @@ public class ReportletPane extends BasicPane {
textPane.setEditable(false);
textPane.setLineWrap(true);
textPane.setFont(FRContext.getDefaultValues().getFRFont().deriveFont(Font.BOLD, 12));
textPane.setFont(DesignUtils.getDefaultGUIFont().applyStyle(Font.BOLD));
textPane.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Schedule_The_Selected_File_Must_Be_End_With_Filter"));
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -41,6 +43,7 @@ public class ReportletPane extends BasicPane {
switchButton = new UIButton("switch");
centerPane.add(GUICoreUtils.createBorderPane(switchButton, BorderLayout.WEST), BorderLayout.NORTH);
switchButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
switchCardPane(t_panel.isVisible());
}
@ -50,12 +53,12 @@ public class ReportletPane extends BasicPane {
centerPane.add(cardPane, BorderLayout.CENTER);
cardPane.setLayout(card = new CardLayout());
templateReportletTree = new TemplateFileTree();
IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class",".frm",".form"});
IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class", ".frm", ".form"});
templateReportletTree.setFileNodeFilter(filter);
cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE");
classReportletTree = new ClassFileTree();
cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS");
this.refreshEnv();
}
@ -75,8 +78,9 @@ public class ReportletPane extends BasicPane {
/**
* 检查是否符合规范
*
* @throws Exception 抛错
* @throws Exception 抛错
*/
@Override
public void checkValid() throws Exception {
String path = this.getSelectedReportletPath();
if (path == null) {
@ -89,7 +93,7 @@ public class ReportletPane extends BasicPane {
* 刷新Env
*/
public void refreshEnv() {
this.templateReportletTree.refreshEnv();
this.classReportletTree.refreshEnv();
}

6
designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java

@ -6,6 +6,7 @@ import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder;
@ -469,6 +470,11 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
globalNameListener = listener;
}
public void registerChangeListener(UIObserverListener listener) {
typeComboBox.registerChangeListener(listener);
textField.registerChangeListener(listener);
}
@Override
public boolean shouldResponseNameListener() {
return false;

5
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe;
import com.fr.base.FRContext;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
@ -16,9 +15,9 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.menu.SnapChatUtil;
import com.fr.design.notification.SnapChat;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
@ -1251,7 +1250,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
super.paint(g);
Image button;
g.setColor(new Color(69, 135, 255));
g.setFont(FRFont.getInstance().applySize(14));
g.setFont(DesignUtils.getDefaultGUIFont().applySize(14));
if (buttonType.equals(NO_BUTTON)) {
return;
}

10
designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java

@ -13,9 +13,9 @@ import com.fr.design.gui.ispinner.UISpinnerUI;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
@ -37,7 +37,6 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
@ -60,7 +59,6 @@ public class JSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6;
private static final int TEN = 10;
private static final int FONT_SIZE = 12;
private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50;
@ -194,9 +192,9 @@ public class JSliderPane extends JPanel {
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button"));
selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
selfAdaptButton.setFont(DesignUtils.getDefaultGUIFont());
customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button"));
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
customButton.setFont(DesignUtils.getDefaultGUIFont());
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
@ -265,7 +263,7 @@ public class JSliderPane extends JPanel {
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%");
percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
percent.setFont(DesignUtils.getDefaultGUIFont());
spinnerPanel.add(percent);
spinnerPanel.setBackground(BACK_COLOR);
return spinnerPanel;

6
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java

@ -23,13 +23,13 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2018/9/12.
@ -253,7 +253,7 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T
@Override
protected Object[] createLine() {
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")};
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")};
}
@Override

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java

@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.other.ChartConditionAttrPane;
import com.fr.design.mainframe.chart.gui.other.ChartInteractivePane;
import com.fr.design.mainframe.chart.gui.type.ChartTabPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import javax.swing.JPanel;
import java.util.ArrayList;
@ -76,11 +77,11 @@ public class ChartOtherPane extends AbstractChartAttrPane {
public String title4PopupWindow() {
return PaneTitleConstants.CHART_OTHER_TITLE;
}
private boolean isHaveCondition() {
return hasCondition;
}
/**
* 设置选中的界面id
*/
@ -110,6 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane {
public void populateBean(Chart chart) {
interactivePane.populateBean(chart);
if (ChartOtherPane.this.isHaveCondition()) {
VanChartRichEditorPane.refreshFieldNames(chart);
conditionAttrPane.populateBean(chart);
}
}
@ -126,7 +128,7 @@ public class ChartOtherPane extends AbstractChartAttrPane {
//特效埋点
ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.EFFECT, chart.getBuryingPointEffectConfig());
}
/**
* 注册 切换按钮的切换事件.
* @param currentChartEditPane 当前编辑的图表编辑界面.

102
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java

@ -8,61 +8,65 @@ import com.fr.data.util.function.MinFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.data.util.function.SumFunction;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.FirstFunction;
/**
* 公式选择.
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-1-8 上午09:52:15
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-1-8 上午09:52:15
*/
public class CalculateComboBox extends UIComboBox{
public class CalculateComboBox extends UIComboBox {
public static final String[] CALCULATE_ARRAY = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_None"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")};
public static final Class[] CLASS_ARRAY = {NoneFunction.class, SumFunction.class, AverageFunction.class,
MaxFunction.class, MinFunction.class, CountFunction.class};
public CalculateComboBox() {
super(CALCULATE_ARRAY);
setSelectedIndex(0);
}
public void reset() {
this.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_None"));
}
/**
* 更新公式选择.
*/
public void populateBean(AbstractDataFunction function) {
for(int i = 0; i < CLASS_ARRAY.length; i++) {
if(function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) {
setSelectedIndex(i);
break;
}
}
}
/**
* 返回当前选择的公式
*/
public AbstractDataFunction updateBean() {
try {
int selectIndex = getSelectedIndex();
if(selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) {
return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance();
}
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
}
return null;
}
public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"),
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"),
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"),
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")};
public static final Class[] CLASS_ARRAY = {FirstFunction.class, NoneFunction.class, SumFunction.class, AverageFunction.class,
MaxFunction.class, MinFunction.class, CountFunction.class};
public CalculateComboBox() {
super(CALCULATE_ARRAY);
setSelectedIndex(2);
}
public void reset() {
this.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"));
}
/**
* 更新公式选择.
*/
public void populateBean(AbstractDataFunction function) {
for (int i = 0; i < CLASS_ARRAY.length; i++) {
if (function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) {
setSelectedIndex(i);
break;
}
}
}
/**
* 返回当前选择的公式
*/
public AbstractDataFunction updateBean() {
try {
int selectIndex = getSelectedIndex();
if (selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) {
return (AbstractDataFunction) CLASS_ARRAY[selectIndex].newInstance();
}
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
}
return null;
}
}

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -70,7 +70,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String[] blank = heads.length == 3 ? new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")} :
String[] blank = heads.length == 3 ? new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")} :
new String[]{StringUtils.EMPTY, StringUtils.EMPTY};
tablePane.addLine(blank);
fireTargetChanged();

191
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java

@ -1,191 +0,0 @@
package com.fr.van.chart.designer.component;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ui.ModernUIPane;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class VanChartRichEditorPane {
private static final String namespace = "Pool";
private static final String variable = "data";
private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html";
private static final String expression = "dispatch()";
private static ModernUIPane<RichEditorModel> richEditorPane;
private static Browser browser;
public static void initRichEditorPane() {
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("VanChartRichEditor"));
try {
singleThreadExecutor.submit(new Runnable() {
@Override
public void run() {
try {
richEditorPane = initPane(new RichEditorModel());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
});
} finally {
singleThreadExecutor.shutdown();
}
}
public static ModernUIPane<RichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) {
RichEditorModel model = getRichEditorModel(richEditor);
if (richEditorPane == null) {
richEditorPane = initPane(model);
} else if (browser != null) {
updatePane(browser, model);
}
return richEditorPane;
}
public static ModernUIPane<RichEditorModel> initPane(RichEditorModel model) {
return new ModernUIPane.Builder<RichEditorModel>()
.prepare(new ScriptContextAdapter() {
public void onScriptContextCreated(ScriptContextEvent event) {
browser = event.getBrowser();
browser.getCacheStorage().clearCache();
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/fineui.min.js"));
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/design/editor/script/i18n.js"));
browser.executeJavaScript(generateTransformI18nJS());
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js"));
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace);
ns.asObject().setProperty(variable, model);
}
})
.withEMB(richEditorPath)
.namespace(namespace).build();
}
public static void updatePane(Browser browser, RichEditorModel model) {
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace);
ns.asObject().setProperty(variable, model);
browser.executeJavaScript("window." + namespace + "." + expression);
}
public static RichEditorModel getRichEditorModel(AttrTooltipRichText richText) {
Map<String, String> paramsMap = richText.getParams();
StringBuilder paramsStr = new StringBuilder(StringUtils.EMPTY);
if (paramsMap != null) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
paramsStr.append(entry.getKey()).append(":").append(entry.getValue());
paramsStr.append("-");
}
}
int len = paramsStr.length();
if (len > 0) {
paramsStr.deleteCharAt(len - 1);
}
String content = richText.getContent();
String initParams = StringUtils.EMPTY;
String align = StringUtils.EMPTY;
if (content.contains("data-id") && !content.contains("class")) {
initParams = richText.getInitParamsContent();
String left = TextAlign.LEFT.getAlign();
String center = TextAlign.CENTER.getAlign();
align = content.contains(left) ? left : center;
}
return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align);
}
public static String generateTransformI18nJS() {
String language = "zh_CN";
Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (locale != null) {
language = locale.toString();
}
return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());";
}
public static class RichEditorModel {
private String content = StringUtils.EMPTY;
private boolean auto = true;
private String params = StringUtils.EMPTY;
private String initParams = StringUtils.EMPTY;
private String align = TextAlign.LEFT.getAlign();
public RichEditorModel() {
}
public RichEditorModel(String content, boolean auto, String params, String initParams, String align) {
this.content = content;
this.auto = auto;
this.params = params;
this.initParams = initParams;
this.align = align;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isAuto() {
return auto;
}
public void setAuto(boolean auto) {
this.auto = auto;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getInitParams() {
return initParams;
}
public void setInitParams(String initParams) {
this.initParams = initParams;
}
public String getAlign() {
return align;
}
public void setAlign(String align) {
this.align = align;
}
}
}

169
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -15,7 +15,12 @@ import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.TableFieldCollection;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
@ -31,7 +36,10 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutChe
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog;
import com.fr.van.chart.designer.component.richText.VanChartRichTextPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JComponent;
@ -45,6 +53,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面
@ -92,7 +103,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private VanChartStylePane parent;
private JPanel showOnPane;
private AttrTooltipRichText richText;
private AttrTooltipContent richTextTooltipContent;
private boolean inCondition;
public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
@ -103,7 +114,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.inCondition = inCondition;
this.parent = parent;
this.showOnPane = showOnPane;
this.richText = new AttrTooltipRichText();
this.richTextTooltipContent = createAttrTooltip();
initFormatPane(parent, showOnPane);
initRichTextFormatPane(parent, showOnPane);
@ -225,11 +237,15 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
public AttrTooltipRichText getRichTextAttr() {
return richText;
return this.richTextTooltipContent.getRichTextAttr();
}
public void setRichTextAttr(AttrTooltipRichText richText) {
this.richText = richText;
this.richTextTooltipContent.setRichTextAttr(richText);
}
public void setRichTextTooltipContent(AttrTooltipContent richTextTooltipContent) {
this.richTextTooltipContent = richTextTooltipContent;
}
private JPanel createLabelContentPane() {
@ -406,24 +422,16 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Format")), createRichFormatPanel()}
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
protected JPanel createRichFormatPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
return TableLayoutHelper.createTableLayoutPane(getRichTextComponents(), getRowSize(p), new double[]{f, p});
}
private JComponent createRichEditorButton() {
UIButton contentTextArea = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Rich_Text_Edit"));
@ -437,34 +445,90 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
private void fireRichEditor() {
final ModernUIPane<VanChartRichEditorPane.RichEditorModel> pane = VanChartRichEditorPane.createRichEditorPane(richText);
BasicDialog dialog = new VanChartRichEditorDialog(DesignerContext.getDesignerFrame(), pane);
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
ModernUIPane<VanChartRichEditorModel> richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText);
VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane);
pane.populate(VanChartRichEditorPane.getRichEditorModel(richText));
BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane);
dialog.addDialogActionListener(new DialogActionAdapter() {
richTextPane.populateBean(this.richTextTooltipContent);
richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText));
richTextDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
VanChartRichEditorPane.RichEditorModel model = pane.update();
AttrTooltipContent temporary = richTextPane.updateBean();
VanChartRichEditorModel model = richEditorPane.update();
String content = model.getContent();
updateLocalRichText(content, model.isAuto());
SwingUtilities.getWindowAncestor(pane).setVisible(false);
TableFieldCollection fieldCollection = temporary.getFieldCollection();
if (fieldCollection != null) {
fieldCollection.checkFieldDefinition(content);
}
updateTooltipFormat(richTextTooltipContent, temporary);
SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false);
}
public void doCancel() {
SwingUtilities.getWindowAncestor(pane).setVisible(false);
SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false);
}
});
dialog.setVisible(true);
richTextDialog.setVisible(true);
if (parent != null) {
parent.attributeChanged();
}
}
protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
return new VanChartRichTextPane(richEditorPane);
}
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
}
private void refreshRichTextParams(AttrTooltipRichText richText) {
String[] fieldNames = getRichTextFieldNames();
AttrTooltipFormat[] fieldFormats = getRichTextFieldFormats();
Map<String, String> params = new HashMap<>();
for (int i = 0, len = fieldNames.length; i < len; i++) {
params.put(fieldNames[i], fieldFormats[i].getJs());
}
List<String> tableFieldNames = VanChartRichEditorPane.getFieldNames();
if (tableFieldNames != null) {
for (String fieldName : tableFieldNames) {
params.put(fieldName, fieldName);
}
}
richText.setParams(params);
}
private JPanel createHtmlPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -695,28 +759,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextCategoryNameFormatPane,
richTextSeriesNameFormatPane,
richTextValueFormatPane,
richTextPercentFormatPane,
richTextChangedValueFormatPane,
richTextChangedPercentFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextCategoryFormat(),
attrTooltipContent.getRichTextSeriesFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat(),
attrTooltipContent.getRichTextChangedValueFormat(),
attrTooltipContent.getRichTextChangedPercentFormat()
};
if (parent != null) {
parent.refreshTableFieldNames();
}
richText = new AttrTooltipRichText();
populateRichTextFormat(formatPaneGroup, formatGroup);
updateTooltipFormat(richTextTooltipContent, attrTooltipContent);
refreshRichTextParams(richTextTooltipContent.getRichTextAttr());
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
@ -729,6 +778,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
formatPane.populate(format);
// 填充面板时,更新富文本编辑器参数
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
formatPane.updateFormatParams(richText.getParams(), format.getJs());
}
}
@ -737,11 +787,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
protected void populateRichText(AttrTooltipRichText tooltipRichText) {
if (tooltipRichText != null) {
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto());
richText.setInitParamsContent(tooltipRichText.getInitParamsContent());
richTextTooltipContent.getRichTextAttr().setInitParamsContent(tooltipRichText.getInitParamsContent());
}
}
protected void checkRichEditorState(AttrTooltipContent attrTooltipContent) {
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
if (ComparatorUtils.equals(richText.getInitParamsContent(), StringUtils.EMPTY)) {
richText.setContent(attrTooltipContent.getRichTextDefaultContent());
richText.setInitParamsContent(attrTooltipContent.getRichTextDefaultParams());
@ -754,7 +806,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
updateLabelType(attrTooltipContent);
updateFormatPane(attrTooltipContent);
if (supportRichEditor()) {
updateRichEditor(attrTooltipContent);
// updateRichEditor(attrTooltipContent);
updateTooltipFormat(attrTooltipContent, this.richTextTooltipContent);
updateTooltipRichText(attrTooltipContent);
}
updateTextAttr(attrTooltipContent);
@ -831,17 +884,35 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
}
protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
if (target == null || source == null) {
return;
}
// 更新富文本字段格式
target.setRichTextCategoryFormat(source.getRichTextCategoryFormat());
target.setRichTextSeriesFormat(source.getRichTextSeriesFormat());
target.setRichTextValueFormat(source.getRichTextValueFormat());
target.setRichTextPercentFormat(source.getRichTextPercentFormat());
// 更新新增字段格式和汇总
target.setFieldCollection(source.getFieldCollection());
}
private void updateLocalRichText(String content, boolean isAuto) {
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
richText.setContent(content);
richText.setAuto(isAuto);
}
private void updateTooltipRichText(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent != null) {
AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr();
tooltipRichText.setContent(richText.getContent());
tooltipRichText.setInitParamsContent(richText.getInitParamsContent());
tooltipRichText.setAuto(richText.isAuto());
AttrTooltipRichText targetRichText = attrTooltipContent.getRichTextAttr();
AttrTooltipRichText localRichText = this.richTextTooltipContent.getRichTextAttr();
targetRichText.setContent(localRichText.getContent());
targetRichText.setInitParamsContent(localRichText.getInitParamsContent());
targetRichText.setAuto(localRichText.isAuto());
}
}
}

79
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java

@ -0,0 +1,79 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FormatPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.text.Format;
public class VanChartFieldAttrPane extends JPanel {
private FormatPane fieldFormatPane;
private CalculateComboBox fieldDataFunction;
private JPanel fieldFunctionPane;
public VanChartFieldAttrPane() {
initComponents();
this.setLayout(new BorderLayout());
this.add(fieldFormatPane, BorderLayout.NORTH);
this.add(fieldFunctionPane, BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0));
}
private void initComponents() {
double p = TableLayout.PREFERRED;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
fieldFormatPane = new FormatPaneWithOutFont() {
protected JPanel createContentPane(Component[][] components) {
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e});
}
};
fieldDataFunction = new CalculateComboBox();
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldDataFunction}
};
fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{d, e});
}
public void registerFunctionListener(ActionListener listener) {
fieldDataFunction.addActionListener(listener);
}
public void registerChangeListener(UIObserverListener listener) {
fieldFormatPane.registerChangeListener(listener);
}
public void populate(Format format, AbstractDataFunction dataFunction, boolean showDataFunction) {
fieldFormatPane.populateBean(format);
fieldDataFunction.populateBean(dataFunction);
fieldFunctionPane.setVisible(showDataFunction);
}
public Format updateFormat() {
return fieldFormatPane.update();
}
public AbstractDataFunction updateDataFunction() {
return fieldDataFunction.updateBean();
}
}

141
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java

@ -0,0 +1,141 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.base.BaseUtils;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.text.Format;
public class VanChartFieldButton extends JPanel {
private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png");
private static final int W = 200;
private static final int H = 28;
private final String fieldName;
private final String fieldId;
private final AttrTooltipFormat tooltipFormat;
private final boolean showDataFunction;
private UIToggleButton fieldButton;
private UIButton addButton;
private DataFunction dataFunction = new NoneFunction();
public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) {
this.fieldName = fieldName;
this.tooltipFormat = format;
this.showDataFunction = showDataFunction;
this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey();
initComponents(fieldName, listener);
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER);
}
public String getFieldName() {
return fieldName;
}
public boolean isEnable() {
return this.tooltipFormat.isEnable();
}
public void setEnable(boolean enable) {
this.tooltipFormat.setEnable(enable);
}
public Format getFormat() {
return tooltipFormat.getFormat();
}
public void setFormat(Format format) {
this.tooltipFormat.setFormat(format);
}
public DataFunction getDataFunction() {
return dataFunction;
}
public void setDataFunction(DataFunction dataFunction) {
this.dataFunction = dataFunction;
}
public boolean isShowDataFunction() {
return showDataFunction;
}
public String getFormatJs() {
return this.tooltipFormat.getJs();
}
private void initComponents(String fieldName, VanChartFieldListener listener) {
fieldButton = new UIToggleButton(fieldName) {
protected MouseListener getMouseListener() {
return new MouseAdapter() {
public void mousePressed(MouseEvent e) {
setSelected(true);
listener.refreshSelectedPane(fieldName);
listener.setGlobalName(fieldName);
listener.populateFieldFormatPane();
}
};
}
};
addButton = new UIButton(ADD_ICON);
addButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
listener.addSelectedField(fieldName, fieldId);
}
});
}
private JPanel getContentPane() {
Component[][] components = new Component[][]{
new Component[]{fieldButton, addButton}
};
double p = TableLayout.PREFERRED;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
double[] rowSize = {p};
double[] columnSize = {e, d};
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 0);
content.setPreferredSize(new Dimension(W, H));
return content;
}
public void setSelectedState(boolean selected) {
fieldButton.setSelected(selected);
}
}

382
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java

@ -0,0 +1,382 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.data.util.function.DataFunction;
import com.fr.design.event.UIObserverListener;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.TableFieldCollection;
import com.fr.plugin.chart.base.TableFieldDefinition;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.Format;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class VanChartFieldListPane extends JPanel {
private static final int FIELD_ADD_W = 400;
private static final int FIELD_ADD_H = 28;
private VanChartFieldButton categoryNameButton;
private VanChartFieldButton seriesNameButton;
private VanChartFieldButton valueButton;
private VanChartFieldButton percentButton;
private VanChartFieldAttrPane fieldAttrPane;
private ModernUIPane<VanChartRichEditorModel> richEditorPane;
private List<String> tableFieldNameList;
private List<VanChartFieldButton> tableFieldButtonList = new ArrayList<>();
private TableFieldCollection tableFieldCollection = new TableFieldCollection();
private VanChartFieldListener fieldListener;
public VanChartFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
List<String> richEditorFieldNames = VanChartRichEditorPane.getFieldNames();
this.tableFieldNameList = richEditorFieldNames == null ? new ArrayList<>() : richEditorFieldNames;
this.fieldAttrPane = fieldAttrPane;
this.richEditorPane = richEditorPane;
initFieldListListener();
initDefaultFieldButton();
registerAttrListener();
this.setLayout(new BorderLayout());
this.add(createDefaultFieldPane(), BorderLayout.CENTER);
this.add(createTableFieldPane(), BorderLayout.SOUTH);
}
public VanChartFieldButton getCategoryNameButton() {
return categoryNameButton;
}
public void setCategoryNameButton(VanChartFieldButton categoryNameButton) {
this.categoryNameButton = categoryNameButton;
}
public VanChartFieldButton getSeriesNameButton() {
return seriesNameButton;
}
public void setSeriesNameButton(VanChartFieldButton seriesNameButton) {
this.seriesNameButton = seriesNameButton;
}
public VanChartFieldButton getValueButton() {
return valueButton;
}
public void setValueButton(VanChartFieldButton valueButton) {
this.valueButton = valueButton;
}
public VanChartFieldButton getPercentButton() {
return percentButton;
}
public void setPercentButton(VanChartFieldButton percentButton) {
this.percentButton = percentButton;
}
public VanChartFieldListener getFieldListener() {
return fieldListener;
}
private JPanel createDefaultFieldPane() {
JPanel fieldPane = new JPanel();
fieldPane.setLayout(new GridLayout(0, 1, 1, 0));
addDefaultFieldButton(fieldPane);
fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H));
fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0));
return fieldPane;
}
protected void initDefaultFieldButton() {
categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
new AttrTooltipCategoryFormat(), false, fieldListener);
seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
new AttrTooltipSeriesFormat(), false, fieldListener);
valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
new AttrTooltipValueFormat(), false, fieldListener);
percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"),
new AttrTooltipPercentFormat(), false, fieldListener);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(categoryNameButton);
fieldPane.add(seriesNameButton);
fieldPane.add(valueButton);
fieldPane.add(percentButton);
}
private JPanel createTableFieldPane() {
if (tableFieldNameList == null || tableFieldNameList.isEmpty()) {
return new JPanel();
}
JPanel tableField = new JPanel();
tableField.setLayout(new GridLayout(0, 1, 1, 0));
for (String name : tableFieldNameList) {
VanChartFieldButton fieldButton = new VanChartFieldButton(name, new AttrTooltipFieldFormat(name), true, fieldListener);
tableField.add(fieldButton);
tableFieldButtonList.add(fieldButton);
}
tableField.setPreferredSize(new Dimension(FIELD_ADD_W, tableFieldNameList.size() * FIELD_ADD_H));
return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField);
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> defaultFieldButtonList = new ArrayList<>();
defaultFieldButtonList.add(categoryNameButton);
defaultFieldButtonList.add(seriesNameButton);
defaultFieldButtonList.add(valueButton);
defaultFieldButtonList.add(percentButton);
return defaultFieldButtonList;
}
private void initFieldListListener() {
fieldListener = new VanChartFieldListener() {
private String fieldName;
public void setGlobalName(String fieldName) {
this.fieldName = fieldName;
}
public String getGlobalName() {
return this.fieldName;
}
public VanChartFieldButton getSelectedField() {
List<VanChartFieldButton> defaultFieldButtonList = getDefaultFieldButtonList();
for (VanChartFieldButton fieldButton : defaultFieldButtonList) {
if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) {
return fieldButton;
}
}
for (VanChartFieldButton fieldButton : tableFieldButtonList) {
if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) {
return fieldButton;
}
}
return null;
}
public void refreshSelectedPane(String fieldName) {
if (ComparatorUtils.equals(fieldName, this.fieldName)) {
return;
}
List<VanChartFieldButton> defaultFieldButtonList = getDefaultFieldButtonList();
for (VanChartFieldButton fieldButton : defaultFieldButtonList) {
fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName));
}
for (VanChartFieldButton fieldButton : tableFieldButtonList) {
fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName));
}
}
public void addSelectedField(String fieldName, String fieldId) {
VanChartRichEditorModel model = richEditorPane.update();
model.setAddition(fieldName);
VanChartRichEditorPane.richEditorAddField(model);
if (tableFieldNameList.contains(fieldName)) {
int index = tableFieldNameList.indexOf(fieldName);
VanChartFieldButton fieldButton = tableFieldButtonList.get(index);
Format fieldFormat = fieldButton.getFormat();
DataFunction dataFunction = fieldButton.getDataFunction();
tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction));
}
}
public void populateFieldFormatPane() {
VanChartFieldButton fieldButton = this.getSelectedField();
if (fieldButton == null) {
return;
}
Format format = fieldButton.getFormat();
AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction();
boolean showDataFunction = fieldButton.isShowDataFunction();
fieldAttrPane.populate(format, dataFunction, showDataFunction);
}
public void updateFieldFormatPane() {
VanChartFieldButton fieldButton = this.getSelectedField();
if (fieldButton == null) {
return;
}
fieldButton.setFormat(fieldAttrPane.updateFormat());
fieldButton.setDataFunction(fieldAttrPane.updateDataFunction());
if (tableFieldNameList.contains(fieldName)) {
Format fieldFormat = fieldButton.getFormat();
DataFunction dataFunction = fieldButton.getDataFunction();
tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction));
}
}
};
}
private void registerAttrListener() {
fieldAttrPane.registerFunctionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fieldListener.updateFieldFormatPane();
}
});
fieldAttrPane.registerChangeListener(new UIObserverListener() {
public void doChange() {
fieldListener.updateFieldFormatPane();
}
});
}
private void checkFieldListSelected() {
List<VanChartFieldButton> defaultFieldButtonList = getDefaultFieldButtonList();
if (defaultFieldButtonList != null && defaultFieldButtonList.size() > 0) {
String selected = defaultFieldButtonList.get(0).getFieldName();
fieldListener.refreshSelectedPane(selected);
fieldListener.setGlobalName(selected);
fieldListener.populateFieldFormatPane();
}
}
public void populate(AttrTooltipContent tooltipContent) {
populateDefaultField(tooltipContent);
populateTableField(tooltipContent);
// 初次打开富文本界面选中第一个
checkFieldListSelected();
}
public void populateDefaultField(AttrTooltipContent tooltipContent) {
populateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat());
populateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat());
populateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat());
populateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat());
}
public void populateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) {
if (button == null || format == null) {
return;
}
button.setEnable(format.isEnable());
button.setFormat(format.getFormat());
}
public void populateTableField(AttrTooltipContent tooltipContent) {
TableFieldCollection fieldCollection = tooltipContent.getFieldCollection();
if (fieldCollection == null) {
return;
}
Map<String, TableFieldDefinition> fieldDefinitionGroup = fieldCollection.getFieldNameFormulaMap();
if (fieldDefinitionGroup == null || fieldDefinitionGroup.isEmpty()) {
return;
}
this.tableFieldCollection = new TableFieldCollection();
for (int i = 0, len = tableFieldNameList.size(); i < len; i++) {
String fieldName = tableFieldNameList.get(i);
VanChartFieldButton fieldButton = tableFieldButtonList.get(i);
TableFieldDefinition fieldDefinition = fieldDefinitionGroup.get(fieldName);
if (fieldDefinitionGroup.containsKey(fieldName)) {
Format fieldFormat = fieldDefinition.getFormat();
DataFunction dataFunction = fieldDefinition.getDataFunction();
fieldButton.setFormat(fieldFormat);
fieldButton.setDataFunction(dataFunction);
this.tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction));
}
}
}
public void update(AttrTooltipContent tooltipContent) {
updateDefaultField(tooltipContent);
updateTableField(tooltipContent);
}
public void updateDefaultField(AttrTooltipContent tooltipContent) {
updateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat());
updateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat());
updateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat());
updateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat());
}
public void updateTableField(AttrTooltipContent tooltipContent) {
try {
tooltipContent.setFieldCollection(this.tableFieldCollection);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) {
if (button == null || format == null) {
return;
}
format.setEnable(button.isEnable());
format.setFormat(button.getFormat());
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.design.event.GlobalNameListener;
public interface VanChartFieldListener extends GlobalNameListener {
public VanChartFieldButton getSelectedField();
public void refreshSelectedPane(String fieldName);
public void addSelectedField(String fieldName, String fieldId);
public void populateFieldFormatPane();
public void updateFieldFormatPane();
}

75
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java

@ -0,0 +1,75 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils;
public class VanChartRichEditorModel {
private String content = StringUtils.EMPTY;
private boolean auto = true;
private String params = StringUtils.EMPTY;
private String initParams = StringUtils.EMPTY;
private String align = TextAlign.LEFT.getAlign();
private String addition = StringUtils.EMPTY;
public VanChartRichEditorModel() {
}
public VanChartRichEditorModel(String content, boolean auto, String params, String initParams, String align) {
this.content = content;
this.auto = auto;
this.params = params;
this.initParams = initParams;
this.align = align;
this.addition = StringUtils.EMPTY;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isAuto() {
return auto;
}
public void setAuto(boolean auto) {
this.auto = auto;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getInitParams() {
return initParams;
}
public void setInitParams(String initParams) {
this.initParams = initParams;
}
public String getAlign() {
return align;
}
public void setAlign(String align) {
this.align = align;
}
public String getAddition() {
return addition;
}
public void setAddition(String addition) {
this.addition = addition;
}
}

195
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java

@ -0,0 +1,195 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.base.TableData;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class VanChartRichEditorPane {
private static final String NAME_SPACE = "Pool";
private static final String VARIABLE = "data";
private static final String RICH_EDITOR_HTML = "/com/fr/design/editor/rich_editor.html";
private static final String REFRESH = "refresh()";
private static final String ADD_FIELD = "addField()";
private static ModernUIPane<VanChartRichEditorModel> richEditorPane;
private static Browser browser;
private static List<String> fieldNames;
public static List<String> getFieldNames() {
return fieldNames;
}
public static void refreshFieldNames(Chart chart) {
VanChartRichEditorPane.fieldNames = null;
if (chart == null) {
return;
}
TopDefinitionProvider definition = chart.getFilterDefinition();
if (definition == null) {
return;
}
DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter();
TableDataSource tableDataSource = adapter == null ? null : adapter.getBook();
TableData tableData = null;
if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) {
OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition;
tableData = oneValueCDDefinition.getTableData();
}
if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) {
MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition;
tableData = moreNameCDDefinition.getTableData();
}
if (tableData == null) {
return;
}
try {
EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource,
tableData, TableData.RESULT_NOT_NEED, false);
List<String> fieldNames = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData);
VanChartRichEditorPane.fieldNames = fieldNames;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) {
VanChartRichEditorModel model = getRichEditorModel(richEditor);
return createRichEditorPane(model);
}
public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(VanChartRichEditorModel model) {
if (richEditorPane == null) {
richEditorPane = initPane(model);
} else {
richEditorRefresh(model);
}
return richEditorPane;
}
public static void richEditorRefresh(VanChartRichEditorModel model) {
if (richEditorPane != null && browser != null) {
refresh(browser, model);
}
}
public static void richEditorAddField(VanChartRichEditorModel model) {
if (richEditorPane != null && browser != null) {
addField(browser, model);
}
}
public static ModernUIPane<VanChartRichEditorModel> initPane(VanChartRichEditorModel model) {
return new ModernUIPane.Builder<VanChartRichEditorModel>()
.prepare(new ScriptContextAdapter() {
public void onScriptContextCreated(ScriptContextEvent event) {
browser = event.getBrowser();
browser.getCacheStorage().clearCache();
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/fineui.min.js"));
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/design/editor/script/i18n.js"));
browser.executeJavaScript(generateTransformI18nJS());
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js"));
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE);
ns.asObject().setProperty(VARIABLE, model);
}
})
.withEMB(RICH_EDITOR_HTML)
.namespace(NAME_SPACE).build();
}
public static void refresh(Browser browser, VanChartRichEditorModel model) {
stateChange(browser, model, REFRESH);
}
public static void addField(Browser browser, VanChartRichEditorModel model) {
stateChange(browser, model, ADD_FIELD);
}
public static void stateChange(Browser browser, VanChartRichEditorModel model, String trigger) {
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE);
ns.asObject().setProperty(VARIABLE, model);
browser.executeJavaScript("window." + NAME_SPACE + "." + trigger);
}
public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) {
Map<String, String> paramsMap = richText.getParams();
StringBuilder paramsStr = new StringBuilder(StringUtils.EMPTY);
if (paramsMap != null) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
paramsStr.append(entry.getKey()).append(":").append(entry.getValue());
paramsStr.append("-");
}
}
int len = paramsStr.length();
if (len > 0) {
paramsStr.deleteCharAt(len - 1);
}
String content = richText.getContent();
String initParams = StringUtils.EMPTY;
String align = StringUtils.EMPTY;
if (content.contains("data-id") && !content.contains("class")) {
initParams = richText.getInitParamsContent();
String left = TextAlign.LEFT.getAlign();
String center = TextAlign.CENTER.getAlign();
align = content.contains(left) ? left : center;
}
return new VanChartRichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align);
}
public static String generateTransformI18nJS() {
String language = "zh_CN";
Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (locale != null) {
language = locale.toString();
}
return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());";
}
}

8
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java → designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java

@ -1,4 +1,4 @@
package com.fr.van.chart.designer.component;
package com.fr.van.chart.designer.component.richText;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
@ -8,17 +8,17 @@ import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.Dimension;
import java.awt.Frame;
public class VanChartRichEditorDialog extends BasicDialog {
public class VanChartRichTextDialog extends BasicDialog {
public static final Dimension DEFAULT = new Dimension(960, 600);
public VanChartRichEditorDialog(Frame parent, BasicPane pane) {
public VanChartRichTextDialog(Frame parent, BasicPane pane) {
super(parent, pane);
this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor"));
this.setBasicDialogSize(DEFAULT);
GUICoreUtils.centerWindow(this);
this.setResizable(true);
this.setResizable(false);
this.setModal(true);
}

95
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java

@ -0,0 +1,95 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.Dimension;
// 标签提示中的富文本面板,包含字段设置和富文本编辑器
public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
private static final int FIELD_PANE_W = 470;
private static final int FIELD_PANE_H = 270;
private static final int RICH_EDITOR_W = 940;
private static final int RICH_EDITOR_H = 260;
private VanChartFieldListPane fieldListPane;
private VanChartFieldAttrPane fieldAttrPane;
public VanChartRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditor) {
fieldAttrPane = new VanChartFieldAttrPane();
fieldListPane = createFieldListPane(fieldAttrPane, richEditor);
this.setLayout(new BorderLayout());
this.add(createFieldContentPane(), BorderLayout.CENTER);
this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH);
}
public VanChartFieldListPane getFieldListPane() {
return fieldListPane;
}
private JPanel createFieldContentPane() {
JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
// 新增字段目录
JPanel fieldListContent = new JPanel();
fieldListContent.setLayout(new BorderLayout());
fieldListContent.add(fieldListPane, BorderLayout.NORTH);
JScrollPane fieldListScrollPane = new JScrollPane(fieldListContent);
fieldListScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H));
fieldListScrollPane.setHorizontalScrollBar(null);
fieldListScrollPane.setBorder(BorderFactory.createTitledBorder("添加字段"));
// 字段格式和汇总
JScrollPane fieldAttrScrollPane = new JScrollPane(fieldAttrPane);
fieldAttrScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H));
fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder("字段设置"));
fieldPane.add(fieldListScrollPane);
fieldPane.add(fieldAttrScrollPane);
return fieldPane;
}
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartFieldListPane(fieldAttrPane, richEditor);
}
private JPanel createRichEditorPane(JPanel richEditor) {
JPanel richEditorPane = new JPanel();
richEditorPane.setLayout(new BorderLayout());
richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H));
richEditorPane.add(richEditor, BorderLayout.CENTER);
return richEditorPane;
}
protected AttrTooltipContent getInitialTooltipContent() {
return new AttrTooltipContent();
}
public void populateBean(AttrTooltipContent tooltipContent) {
fieldListPane.populate(tooltipContent);
}
public AttrTooltipContent updateBean() {
AttrTooltipContent content = getInitialTooltipContent();
fieldListPane.update(content);
return content;
}
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
}

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java

@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.style.axis.VanChartAxisPane;
import com.fr.van.chart.designer.style.background.VanChartAreaPane;
import com.fr.van.chart.designer.style.datasheet.VanChartDataSheetPane;
@ -75,4 +76,8 @@ public class VanChartStylePane extends ChartStylePane {
protected void addVanChartTooltipPane(List<BasicPane> paneList) {
paneList.add(new VanChartTooltipPane(VanChartStylePane.this));
}
public void refreshTableFieldNames() {
VanChartRichEditorPane.refreshFieldNames(getChart());
}
}

41
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java

@ -0,0 +1,41 @@
package com.fr.van.chart.map.designer.style;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListener;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
public class VanChartMapRichTextFieldListPane extends VanChartFieldListPane {
public VanChartMapRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
protected void initDefaultFieldButton() {
VanChartFieldListener fieldListener = getFieldListener();
VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Area_Name"),
new AttrTooltipAreaNameFormat(), false, fieldListener);
VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
new AttrTooltipSeriesFormat(), false, fieldListener);
VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
new AttrTooltipValueFormat(), false, fieldListener);
VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"),
new AttrTooltipPercentFormat(), false, fieldListener);
setCategoryNameButton(categoryNameButton);
setSeriesNameButton(seriesNameButton);
setValueButton(valueButton);
setPercentButton(percentButton);
}
}

32
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java

@ -1,18 +1,19 @@
package com.fr.van.chart.map.designer.style.label;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -21,6 +22,7 @@ import javax.swing.JPanel;
* Created by Mitisky on 16/5/20.
*/
public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) {
super(parent, showOnPane, inCondition);
}
@ -33,12 +35,22 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Area_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipAreaNameFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
}
@Override

31
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java

@ -1,17 +1,18 @@
package com.fr.van.chart.map.designer.style.tooltip;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -32,12 +33,22 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane {
setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Area_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipAreaNameFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
}
@Override

9
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java

@ -62,14 +62,7 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
@Override
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextXFormatPane(), null},
new Component[]{getRichTextYFormatPane(), null},
new Component[]{getRichTextSizeFormatPane(), null},
new Component[]{richTextChangedSizeFormatPane, null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
};
return null;
}

93
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java

@ -0,0 +1,93 @@
package com.fr.van.chart.scatter;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipXFormat;
import com.fr.plugin.chart.base.format.AttrTooltipYFormat;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListener;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class VanChartScatterRichTextFieldListPane extends VanChartFieldListPane {
private VanChartFieldButton richTextXFormatPane;
private VanChartFieldButton richTextYFormatPane;
private VanChartFieldButton richTextSizeFormatPane;
public VanChartScatterRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
public VanChartFieldButton getRichTextXFormatPane() {
return richTextXFormatPane;
}
public VanChartFieldButton getRichTextYFormatPane() {
return richTextYFormatPane;
}
public VanChartFieldButton getRichTextSizeFormatPane() {
return richTextSizeFormatPane;
}
protected void initDefaultFieldButton() {
super.initDefaultFieldButton();
VanChartFieldListener listener = getFieldListener();
richTextXFormatPane = new VanChartFieldButton("x", new AttrTooltipXFormat(), false, listener);
richTextYFormatPane = new VanChartFieldButton("y", new AttrTooltipYFormat(), false, listener);
richTextSizeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), new AttrTooltipSizeFormat(), false, listener);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getSeriesNameButton());
fieldPane.add(richTextXFormatPane);
fieldPane.add(richTextYFormatPane);
fieldPane.add(richTextSizeFormatPane);
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getSeriesNameButton());
fieldButtonList.add(richTextXFormatPane);
fieldButtonList.add(richTextYFormatPane);
fieldButtonList.add(richTextSizeFormatPane);
return fieldButtonList;
}
public void populateDefaultField(AttrTooltipContent tooltipContent) {
super.populateDefaultField(tooltipContent);
if (tooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent;
populateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat());
populateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat());
populateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat());
}
}
public void updateDefaultField(AttrTooltipContent tooltipContent) {
super.updateDefaultField(tooltipContent);
if (tooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent;
updateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat());
updateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat());
updateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat());
}
}
}

110
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java

@ -1,17 +1,22 @@
package com.fr.van.chart.scatter;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipXFormat;
import com.fr.plugin.chart.base.format.AttrTooltipYFormat;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.XFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.YFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import com.fr.van.chart.designer.component.richText.VanChartRichTextPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -26,10 +31,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
private YFormatPaneWithCheckBox yFormatPane;
private ValueFormatPaneWithCheckBox sizeFormatPane;
private XFormatPaneWithoutCheckBox richTextXFormatPane;
private YFormatPaneWithoutCheckBox richTextYFormatPane;
private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane;
public XFormatPaneWithCheckBox getXFormatPane() {
return xFormatPane;
}
@ -42,18 +43,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
return sizeFormatPane;
}
public XFormatPaneWithoutCheckBox getRichTextXFormatPane() {
return richTextXFormatPane;
}
public YFormatPaneWithoutCheckBox getRichTextYFormatPane() {
return richTextYFormatPane;
}
public ValueFormatPaneWithoutCheckBox getRichTextSizeFormatPane() {
return richTextSizeFormatPane;
}
public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){
super(parent, showOnPane);
}
@ -71,13 +60,18 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
return new VanChartRichTextPane(richEditorPane) {
richTextXFormatPane = new XFormatPaneWithoutCheckBox(parent, showOnPane);
richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane);
richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane);
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartScatterRichTextFieldListPane(fieldAttrPane, richEditor);
}
protected AttrTooltipContent getInitialTooltipContent() {
return createAttrTooltip();
}
};
}
@Override
@ -90,16 +84,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
};
}
@Override
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{richTextXFormatPane, null},
new Component[]{richTextYFormatPane, null},
new Component[]{richTextSizeFormatPane, null}
};
}
@Override
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
super.populateFormatPane(attrTooltipContent);
@ -111,30 +95,20 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
}
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
"x",
"y",
Toolkit.i18nText("Fine-Design_Chart_Use_Value")};
}
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextSeriesNameFormatPane(),
richTextXFormatPane,
richTextYFormatPane,
richTextSizeFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
scatterAttrTooltipContent.getRichTextSeriesFormat(),
scatterAttrTooltipContent.getRichTextXFormat(),
scatterAttrTooltipContent.getRichTextYFormat(),
scatterAttrTooltipContent.getRichTextSizeFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipSeriesFormat(),
new AttrTooltipXFormat(),
new AttrTooltipYFormat(),
new AttrTooltipSizeFormat()};
}
@Override
@ -148,14 +122,16 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
}
}
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
super.updateRichEditor(attrTooltipContent);
protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
super.updateTooltipFormat(target, source);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
richTextXFormatPane.update(scatterAttrTooltipContent.getRichTextXFormat());
richTextYFormatPane.update(scatterAttrTooltipContent.getRichTextYFormat());
richTextSizeFormatPane.update(scatterAttrTooltipContent.getRichTextSizeFormat());
if (target instanceof ScatterAttrTooltipContent && source instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent targetScatter = (ScatterAttrTooltipContent) target;
ScatterAttrTooltipContent sourceScatter = (ScatterAttrTooltipContent) source;
targetScatter.setRichTextXFormat(sourceScatter.getRichTextXFormat());
targetScatter.setRichTextYFormat(sourceScatter.getRichTextYFormat());
targetScatter.setRichTextSizeFormat(sourceScatter.getRichTextSizeFormat());
}
}

41
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java

@ -0,0 +1,41 @@
package com.fr.van.chart.wordcloud.designer.style;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListener;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
public class VanChartWordCloudRichTextFieldListPane extends VanChartFieldListPane {
public VanChartWordCloudRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
protected void initDefaultFieldButton() {
VanChartFieldListener fieldListener = getFieldListener();
VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"),
new AttrTooltipCategoryFormat(), false, fieldListener);
VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Name"),
new AttrTooltipNameFormat(), false, fieldListener);
VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Value"),
new AttrTooltipValueFormat(), false, fieldListener);
VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"),
new AttrTooltipPercentFormat(), false, fieldListener);
setCategoryNameButton(categoryNameButton);
setSeriesNameButton(seriesNameButton);
setValueButton(valueButton);
setPercentButton(percentButton);
}
}

55
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java

@ -2,17 +2,22 @@ package com.fr.van.chart.wordcloud.designer.style;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import com.fr.van.chart.designer.component.richText.VanChartRichTextPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -53,31 +58,37 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP
setPercentFormatPane(percentFormatPane);
}
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name");
protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
return new VanChartRichTextPane(richEditorPane) {
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartWordCloudRichTextFieldListPane(fieldAttrPane, richEditor);
}
};
SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Word_Name");
protected AttrTooltipContent getInitialTooltipContent() {
return createAttrTooltip();
}
};
ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Word_Value");
}
}
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Word_Name"),
Toolkit.i18nText("Fine-Design_Chart_Word_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane);
}
setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane);
setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane);
setRichTextValueFormatPane(richTextValueFormatPane);
setRichTextPercentFormatPane(richTextPercentFormatPane);
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipNameFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
}
@Override
protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());

31
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -88,8 +88,7 @@
{type: "bi.rich_editor_color_chooser"},
{type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"},
{type: "bi.design.chart.common.editor.insert_param"}
{type: "bi.rich_editor_align_right_button"}
]
},
ref: function (_ref) {
@ -97,7 +96,7 @@
}
});
Pool.dispatch = function () {
Pool.refresh = function () {
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
@ -117,7 +116,31 @@
});
rich_editor.setFocus();
}
};
Pool.addField = function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var addition = Pool.data.getAddition();
if (addition) {
// todo 暂时先处理成在content后加一行
content += '<p style="text-align:' + align + ';">' + editorService.getEditorParamImage(addition) + '<br></p>';
}
rich_editor.editor.bindToolbar(rich_editor.bar);
rich_editor.setValue({
content: content,
isAuto: isAuto,
dimensionIds: getDimensionIds(params)
});
rich_editor.setFocus();
};
Pool.update = function () {
var {content, isAuto} = rich_editor.getValue();

1
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -50,6 +50,7 @@
},
items: [{
type: "bi.htape",
tgap: 5,
items: [{
type: "bi.label",
text: BI.i18nText("BI-Design_Font_Style") + ": ",

13
designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java

@ -42,6 +42,19 @@ public interface LayoutAdapter {
*/
boolean addBean(XCreator creator, int x, int y);
/**
* 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的
* addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能
*
* @param creator 被添加的新组件
* @param x 添加的位置x该位置是相对于container的
* @param y 添加的位置y该位置是相对于container的
* @param accept 是否添加新组件
* @return 是否添加成功成功返回true否则false
*/
boolean addBean(XCreator creator, int x, int y, boolean accept);
/**
* 组件的ComponentAdapter在添加组件时如果发现布局管理器不为空会继而调用该布局管理器的
* addComp方法来完成组件的具体添加在该方法内布局管理器可以提供额外的功能

435
designer-form/src/main/java/com/fr/design/designer/creator/XButton.java

@ -14,11 +14,11 @@ import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.editors.ShortCutTextEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.mainframe.widget.renderer.IconCellRenderer;
import com.fr.design.utils.DesignUtils;
import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import com.fr.general.Background;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
@ -29,7 +29,6 @@ import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
@ -41,14 +40,13 @@ import java.beans.IntrospectionException;
*/
public class XButton extends XWidgetCreator {
public final static Background DEFAULTBG = new GradientBackground(new Color(247,247,247),new Color(210,210,210), GradientBackground.TOP2BOTTOM);
public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12);
public final static Background DEFAULTBG = new GradientBackground(new Color(247, 247, 247), new Color(210, 210, 210), GradientBackground.TOP2BOTTOM);
public final static Color DEFAULTFOREGROUNDCOLOR = Color.BLACK;
private Background bg;
private UILabel contentLabel;
private Background bg;
private UILabel contentLabel;
public XButton(Button widget, Dimension initSize) {
this(new FreeButton(widget),initSize);
this(new FreeButton(widget), initSize);
}
public XButton(FreeButton widget, Dimension initSize) {
@ -56,143 +54,146 @@ public class XButton extends XWidgetCreator {
}
public XButton(FormSubmitButton widget, Dimension initSize) {
super(widget, initSize);
super(widget, initSize);
}
public Background getContentBackground() {
return bg;
}
public Background getContentBackground() {
return bg;
}
public void setContentBackground(Background bg) {
this.bg = bg;
}
public void setContentBackground(Background bg) {
this.bg = bg;
}
public UILabel getContentLabel() {
return contentLabel;
}
public UILabel getContentLabel() {
return contentLabel;
}
public void setContentLabel(UILabel contentLabel) {
this.contentLabel = contentLabel;
}
public void setContentLabel(UILabel contentLabel) {
this.contentLabel = contentLabel;
}
/**
*根据下拉框选择返回按钮样式的默认设置或自定义设置列表
* @return 列表
* @throws IntrospectionException 抛错
* 根据下拉框选择返回按钮样式的默认设置或自定义设置列表
*
* @return 列表
* @throws IntrospectionException 抛错
*/
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = ((FreeButton) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle();
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), crp);
}
protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{
CRPropertyDescriptor[] crPropertyDescriptors = {
new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))
.setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("hotkeys", this.data.getClass())
.setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setEditorClass(ShortCutTextEditor.class)
};
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = ((FreeButton) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle();
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), crp);
}
protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException {
CRPropertyDescriptor[] crPropertyDescriptors = {
new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))
.setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("hotkeys", this.data.getClass())
.setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setEditorClass(ShortCutTextEditor.class)
};
return crPropertyDescriptors[i];
}
protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException{
return new CRPropertyDescriptor[]{
creatNonListenerStyle(0) .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
setButtonText(((FreeButton) data).getText());
}
}),
creatNonListenerStyle(1) .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
}),
creatNonListenerStyle(2).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
bg = ((FreeButton) data).getInitialBackground();
}
}),
creatNonListenerStyle(3),
creatNonListenerStyle(4),
creatNonListenerStyle(5) .setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
FreeButton button = (FreeButton) data;
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground());
}
}
}),
creatNonListenerStyle(6),
creatNonListenerStyle(7)
};
}
protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException {
return new CRPropertyDescriptor[]{
creatNonListenerStyle(0).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
setButtonText(((FreeButton) data).getText());
}
}),
creatNonListenerStyle(1).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
}),
creatNonListenerStyle(2).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
bg = ((FreeButton) data).getInitialBackground();
}
}),
creatNonListenerStyle(3),
creatNonListenerStyle(4),
creatNonListenerStyle(5).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
FreeButton button = (FreeButton) data;
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground());
}
}
}),
creatNonListenerStyle(6),
creatNonListenerStyle(7)
};
}
protected CRPropertyDescriptor[] getisnotCustomStyle() throws IntrospectionException {
return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("text", this.data.getClass())
.setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
setButtonText(((FreeButton) data).getText());
}
}),
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
}),
new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))
.setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("hotkeys", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setEditorClass(ShortCutTextEditor.class)
};
return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("text", this.data.getClass())
.setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
setButtonText(((FreeButton) data).getText());
}
}),
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
}),
new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))
.setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("hotkeys", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
.setEditorClass(ShortCutTextEditor.class)
};
}
@Override
protected JComponent initEditor() {
if (editor == null) {
@ -202,110 +203,114 @@ public class XButton extends XWidgetCreator {
return editor;
}
protected UILabel initContentLabel() {
return new UILabel();
}
protected UILabel initContentLabel() {
return new UILabel();
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
//不可见时,按钮.4f透明
AlphaComposite composite = this.data.isVisible() ? (AlphaComposite)((Graphics2D)g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER,HALF_OPACITY);
((Graphics2D)g).setComposite(composite);
Dimension panelSize = (contentLabel).getSize();
if(bg != null) {
bg.paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight()));
}
}
public void setButtonText(String text) {
contentLabel.setText(text);
}
private void checkButonType() {
UILabel l = contentLabel;
FreeButton button = (FreeButton) data;
if (!button.isCustomStyle()) {
l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148)));
bg = DEFAULTBG;
contentLabel.setFont(DEFAULTFT);
AlphaComposite composite = this.data.isVisible() ? (AlphaComposite) ((Graphics2D) g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER, HALF_OPACITY);
((Graphics2D) g).setComposite(composite);
Dimension panelSize = (contentLabel).getSize();
if (bg != null) {
bg.paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight()));
}
}
public void setButtonText(String text) {
contentLabel.setText(text);
}
private void checkButonType() {
UILabel l = contentLabel;
FreeButton button = (FreeButton) data;
if (!button.isCustomStyle()) {
l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148)));
bg = DEFAULTBG;
contentLabel.setFont(DesignUtils.getDefaultGUIFont());
contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR);
editor.setLayout(new BorderLayout());
editor.add(l, BorderLayout.CENTER);
} else {
l.setBorder(null);
editor.setLayout(new BorderLayout());
editor.add(l,BorderLayout.CENTER);
editor.add(l, BorderLayout.CENTER);
} else {
l.setBorder(null);
editor.setLayout(new BorderLayout());
editor.add(l, BorderLayout.CENTER);
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground());
}
l.setBounds(0, 0, button.getButtonWidth() == 0 ? this.getWidth() : button.getButtonWidth(), button
.getButtonHeight() == 0 ? this.getHeight() : button.getButtonHeight());
bg = button.getInitialBackground();
}
}
l.setBounds(0, 0, button.getButtonWidth() == 0 ? this.getWidth() : button.getButtonWidth(), button
.getButtonHeight() == 0 ? this.getHeight() : button.getButtonHeight());
bg = button.getInitialBackground();
}
}
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
checkButonType();
UILabel l = contentLabel;
FreeButton button = (FreeButton) data;
l.setText(button.getText());
if (button.isCustomStyle() && button.getFont() != null) {
l.setFont(button.getFont().applyResolutionNP(FontTransformUtil.getDesignerFontResolution()));
l.setForeground(button.getFont().getForeground());
}
l.setVerticalAlignment(SwingConstants.CENTER);
l.setHorizontalAlignment(SwingConstants.CENTER);
if (button.getButtonHeight() > 0 && button.getButtonWidth() > 0) {
this.setSize(button.getButtonWidth(), button.getButtonHeight());
l.setSize(button.getButtonWidth(), button.getButtonHeight());
XLayoutContainer parent;
if ((parent = XCreatorUtils.getParentXLayoutContainer(this)) instanceof XWAbsoluteLayout) {
((XWAbsoluteLayout) parent).toData().setBounds(toData(), getBounds());
}
}
l.setEnabled(button.isEnabled());
}
protected void initXCreatorProperties() {
super.initXCreatorProperties();
checkButonType();
UILabel l = contentLabel;
FreeButton button = (FreeButton) data;
l.setText(button.getText());
if (button.isCustomStyle() && button.getFont() != null) {
l.setFont(button.getFont().applyResolutionNP(FontTransformUtil.getDesignerFontResolution()));
l.setForeground(button.getFont().getForeground());
}
l.setVerticalAlignment(SwingConstants.CENTER);
l.setHorizontalAlignment(SwingConstants.CENTER);
if (button.getButtonHeight() > 0 && button.getButtonWidth() > 0) {
this.setSize(button.getButtonWidth(), button.getButtonHeight());
l.setSize(button.getButtonWidth(), button.getButtonHeight());
XLayoutContainer parent;
if ((parent = XCreatorUtils.getParentXLayoutContainer(this)) instanceof XWAbsoluteLayout) {
((XWAbsoluteLayout) parent).toData().setBounds(toData(), getBounds());
}
}
l.setEnabled(button.isEnabled());
}
/**
* 初始化按钮的Size
* @return 尺寸
*
* @return 尺寸
*/
public Dimension initEditorSize() {
FreeButton button = (FreeButton) data;
if (checkbutton(button)) {
return new Dimension(button.getButtonWidth(), button.getButtonHeight());
}
return super.initEditorSize();
}
private boolean checkbutton(FreeButton button){
return (button.isCustomStyle() && button.getButtonHeight() > 0 && button.getButtonWidth() > 0) ;
@Override
public Dimension initEditorSize() {
FreeButton button = (FreeButton) data;
if (checkbutton(button)) {
return new Dimension(button.getButtonWidth(), button.getButtonHeight());
}
return super.initEditorSize();
}
private boolean checkbutton(FreeButton button) {
return (button.isCustomStyle() && button.getButtonHeight() > 0 && button.getButtonWidth() > 0);
}
@Override
protected String getIconName() {
return "button_16.png";
}
/**
* data属性改变触发其他操作
*
*/
public void firePropertyChange(){
FreeButton button = (FreeButton) data;
setButtonText(button.getText());
checkButonType();
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground());
}
}
/**
* data属性改变触发其他操作
*/
@Override
public void firePropertyChange() {
FreeButton button = (FreeButton) data;
setButtonText(button.getText());
checkButonType();
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground());
}
}
}

70
designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java

@ -1,50 +1,48 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.FRContext;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.form.ui.Radio;
import com.fr.general.FRFont;
import javax.swing.*;
import java.awt.*;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Font;
/**
* @deprecated
*/
@Deprecated
public class RadioDefinePane extends AbstractDataModify<Radio> {
public RadioDefinePane(XCreator xCreator) {
super(xCreator);
iniComoponents();
}
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel infoLabel = new UILabel();
FRFont frFont = FRContext.getDefaultValues().getFRFont();
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24));
infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText(
"Fine-Design_Report_No_Editor_Property_Definition") + ".");
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
this.add(infoLabel, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "radio";
}
@Override
public void populateBean(Radio cellWidget) {
}
@Override
public Radio updateBean() {
return (Radio)creator.toData();
}
public RadioDefinePane(XCreator xCreator) {
super(xCreator);
iniComoponents();
}
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel infoLabel = new UILabel();
infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD));
infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText(
"Fine-Design_Report_No_Editor_Property_Definition") + ".");
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
this.add(infoLabel, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "radio";
}
@Override
public void populateBean(Radio cellWidget) {
}
@Override
public Radio updateBean() {
return (Radio) creator.toData();
}
}

10
designer-realize/src/main/java/com/fr/design/condition/FontPane.java

@ -7,13 +7,13 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.style.FRFontPane;
import com.fr.design.style.FRFontPreviewArea;
import com.fr.general.FRFont;
import com.fr.design.utils.DesignUtils;
import com.fr.report.cell.cellattr.highlight.FRFontHighlightAction;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -60,7 +60,7 @@ public class FontPane extends ConditionAttrSingleConditionPane<HighlightAction>
this.add(frFontPreviewPane);
this.add(editFRFontButton);
this.add(this.fontScopeComboBox);
this.frFontPreviewPane.setFontObject(FRFont.getInstance());
this.frFontPreviewPane.setFontObject(DesignUtils.getDefaultGUIFont());
}
@Override

9
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine;
import com.fr.base.extension.FileExtension;
import com.fr.design.utils.DesignUtils;
import com.fr.general.CloudCenter;
import java.awt.Color;
@ -73,15 +74,15 @@ public class AlphaFineConstants {
public static final String HIGH_LIGHT_COLOR = "rgb(51,148,240)";
public static final Font SMALL_FONT = new Font("Song_TypeFace", 0, 10);
public static final Font SMALL_FONT = DesignUtils.getDefaultGUIFont().applySize(10);
public static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 12);
public static final Font MEDIUM_FONT = DesignUtils.getDefaultGUIFont().applySize(12);
public static final Font MEDIUM_FONT_ANOTHER = new Font("HiraginoSansGB-W3", 0, 12);
public static final Font LARGE_FONT = new Font("Song_TypeFace", 0, 18);
public static final Font LARGE_FONT = DesignUtils.getDefaultGUIFont().applySize(18);
public static final Font GREATER_FONT = new Font("Song_TypeFace", 0, 20);
public static final Font GREATER_FONT = DesignUtils.getDefaultGUIFont().applySize(20);
public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/";

12
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java

@ -3,10 +3,14 @@ package com.fr.design.mainframe.alphafine.preview;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.general.FRFont;
import com.fr.design.utils.DesignUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
/**
* Created by XiaXiang on 2017/8/14.
@ -23,7 +27,7 @@ public class NoResultPane extends JPanel {
image.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0));
UILabel description = new UILabel(title);
description.setForeground(AlphaFineConstants.MEDIUM_GRAY);
description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14));
description.setFont(DesignUtils.getDefaultGUIFont().applySize(14));
description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0));
description.setHorizontalAlignment(SwingConstants.CENTER);
add(image, BorderLayout.CENTER);

18
designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java

@ -8,16 +8,24 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.*;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
@ -37,7 +45,7 @@ public class BBSLoginDialog extends UIDialog {
private static final int DIALOG_WIDTH = 400;
private static final int DIALOG_HEIGHT = 200;
private static final Font DEFAULT_FONT = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, 0, 14);
private static final Font DEFAULT_FONT = DesignUtils.getDefaultGUIFont().applySize(14);
private static final int TIME_OUT = 10000;
private static final int BUTTON_WIDTH = 90;

5
designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java

@ -12,6 +12,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
@ -32,7 +33,6 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
@ -59,7 +59,6 @@ public class ReportColumnsPane extends BasicPane{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Columns_Repeat_Column")
};
private static final String FONT_NAME = "simsun";
private static final int FONT_SIZE = 14;
private UIButtonGroup onOffButtonGroup;
@ -109,7 +108,7 @@ public class ReportColumnsPane extends BasicPane{
onOffButtonGroup.addActionListener(onOffListener);
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns"));
FRFont uiLableFont = FRFont.getInstance(FONT_NAME, Font.PLAIN, FONT_SIZE);
FRFont uiLableFont = DesignUtils.getDefaultGUIFont().applySize(FONT_SIZE);
uiLabel.setFont(uiLableFont);
uiLabel.setHorizontalAlignment(SwingConstants.CENTER);
int uiLabelWidth = GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns"), uiLableFont);

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

@ -1,12 +1,12 @@
package com.fr.design.report;
import com.fr.base.BaseFormula;
import com.fr.base.FRContext;
import com.fr.base.Style;
import com.fr.design.cell.editor.RichTextToolBar;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
@ -37,7 +37,7 @@ public class RichTextPane extends BasicPane {
//12号字体有个奇怪的bug, 字体下部分渲染会截断一部分, 换其他字体没问题, 字体改大小也没问题.
//直接弄个jtexarea放到jframe里也有同样问题, 不知道是字体渲染bug还是jdk问题
public static final FRFont DEFAUL_FONT = FRContext.getDefaultValues().getFRFont().applySize(13);
public static final FRFont DEFAUL_FONT = DesignUtils.getDefaultGUIFont().applySize(13);
private RichTextEditingPane textPane;
//用于populate时动态更新按钮

68
designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java

@ -1,48 +1,46 @@
package com.fr.design.widget.ui;
import com.fr.base.FRContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.form.ui.Radio;
import com.fr.general.FRFont;
import javax.swing.*;
import java.awt.*;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Font;
/**
* @deprecated
*/
@Deprecated
public class RadioDefinePane extends AbstractDataModify<Radio> {
public RadioDefinePane() {
this.iniComoponents();
}
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel infoLabel = new UILabel();
FRFont frFont = FRContext.getDefaultValues().getFRFont();
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24));
infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText(
"Fine-Design_Report_No_Editor_Property_Definition") + ".");
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
this.add(infoLabel, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return "radio";
}
@Override
public void populateBean(Radio cellWidget) {
}
@Override
public Radio updateBean() {
return new Radio();
}
public RadioDefinePane() {
this.iniComoponents();
}
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel infoLabel = new UILabel();
infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD));
infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText(
"Fine-Design_Report_No_Editor_Property_Definition") + ".");
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
this.add(infoLabel, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return "radio";
}
@Override
public void populateBean(Radio cellWidget) {
}
@Override
public Radio updateBean() {
return new Radio();
}
}

12
designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java

@ -1,14 +1,13 @@
package com.fr.design.widget.ui;
import com.fr.base.FRContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.form.ui.NameWidget;
import com.fr.general.FRFont;
import javax.swing.*;
import java.awt.*;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Font;
public class UserEditorDefinePane extends AbstractDataModify<NameWidget> {
private NameWidget nWidget;
@ -20,8 +19,7 @@ public class UserEditorDefinePane extends AbstractDataModify<NameWidget> {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel infoLabel = new UILabel();
FRFont frFont = FRContext.getDefaultValues().getFRFont();
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24));
infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD));
infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText(
"Fine-Design_Report_Widget_User_Defined_Editor") + ".");
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);

4
designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -8,6 +8,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.DesignUtils;
import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.ReportHelper;
import com.fr.stable.StringUtils;
@ -20,7 +21,6 @@ import javax.swing.event.DocumentListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -77,7 +77,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
}
private void initTextField() {
stringTextField.setFont(new Font("Dialog", Font.PLAIN, 12));
stringTextField.setFont(DesignUtils.getDefaultGUIFont());
stringTextField.setOpaque(true);
stringTextField.setLineWrap(true);
stringTextField.setWrapStyleWord(true);

Loading…
Cancel
Save