Browse Source

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

* commit '863fce65ac5a2275f9a1154ea74372ad53352ec5':
  CHART-15968 解决标签界面属性保存错误
  CHART-15566 预定义边界界面图表预览
  REPORT-40969 数据集-数据库数据集-重命名有问题
  REPORT-38514 标签控件的属性界面-字体大小显示异常 【问题原因】标签属性界面,跟字体有关的一块由FRFontPane控制,这个界面表示字体大小的fontSizeComboBox会将接收到的值转化为浮点数而不是整数,变成浮点数之后会出现显示不全的情况 【改动思路】17年Momeak的一个改动(无JIRA任务)将字体大小从整数修改为浮点数,考虑到这一点,不采取改回整数的修改方案,而是将fontSizeComboBox与前一个组件之间的间隙减小,TableLayout下fontSizeComboBox就会被自动拉长,拉长后能够完整显示字体大小,改动效果已经通过产品确认
  Revert "无JIRA任务 修复feature"
  无JIRA任务 修复feature
research/10.0
superman 4 years ago
parent
commit
8a0591ffba
  1. 14
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  3. 25
      designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java
  6. 6
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSelectPane.java
  7. 100
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ChartPreStylePreView.java
  8. 109
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java
  9. 2
      designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java
  10. 6
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  11. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartLabelPane.java
  12. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java
  13. 15
      designer-realize/src/main/java/com/fr/grid/GridUI.java

14
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -24,11 +24,13 @@ import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* TableDataList Pane. * TableDataList Pane.
@ -49,8 +51,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
//说明双击之后又取消了,啥也不用做 //说明双击之后又取消了,啥也不用做
return; return;
} }
TableDataSource source = DesignTableDataManager.getEditingTableDataSource(); Set<String> allDSNames = DesignTableDataManager.getGlobalDataSet().keySet();
String[] allDSNames = DesignTableDataManager.getAllDSNames(source);
String[] allListNames = nameableList.getAllNames(); String[] allListNames = nameableList.getAllNames();
allListNames[editingIndex] = StringUtils.EMPTY; allListNames[editingIndex] = StringUtils.EMPTY;
@ -73,7 +74,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
return; return;
} }
boolean isRepeated = isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName); boolean isRepeated = isNameRepeated(new Collection[]{allDSNames, Arrays.asList(allListNames)}, tempName);
if (isRepeated) { if (isRepeated) {
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
@ -98,11 +99,16 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) { for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) {
if (StringUtils.equals(oldName, entry.getValue())) { if (StringUtils.equals(oldName, entry.getValue())) {
oldName = entry.getKey(); oldName = entry.getKey();
break;
} }
} }
if (StringUtils.equals(oldName, newName)) {
//a -> b;b -> a,说明没改
dsNameChangedMap.remove(oldName);
} else {
dsNameChangedMap.put(oldName, newName); dsNameChangedMap.put(oldName, newName);
} }
}
/** /**
* 名字是否允许 * 名字是否允许

7
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -27,6 +27,7 @@ import java.awt.Component;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider { public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List"; private static final String LIST_NAME = "JControl_List";
@ -190,9 +191,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
return getHelper().getSelectedName(); return getHelper().getSelectedName();
} }
protected boolean isNameRepeated(java.util.List[] list, String name) { protected boolean isNameRepeated(Collection[] collections, String name) {
for (int i = 0; i < list.length; i++) { for (int i = 0; i < collections.length; i++) {
if (list[i].contains(name)) { if (collections[i].contains(name)) {
isNameRepeated = true; isNameRepeated = true;
return true; return true;
} }

25
designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java

@ -25,10 +25,20 @@ import com.fr.general.FRFont;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Vector; import java.util.Vector;
@ -67,11 +77,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton subPane; private UIToggleButton subPane;
private JPanel linePane; private JPanel linePane;
private int italic_bold; private int italic_bold;
/**
* LeftPane和RightPane之间的间隙也是fontSizeStyleComboBox与fontSizeComboBox之间的间隙之前的默认值为VGAP_LARGE
*/
private int hGapBetweenLeftPaneAndRightPane = LayoutConstants.VGAP_LARGE;
public FRFontPane() { public FRFontPane() {
this.initComponents(); this.initComponents();
} }
public FRFontPane(int hGapBetweenLeftPaneAndRightPane) {
this.hGapBetweenLeftPaneAndRightPane = hGapBetweenLeftPaneAndRightPane;
this.initComponents();
}
public static void main(String[] args) { public static void main(String[] args) {
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -345,7 +364,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() { private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout()); JPanel createPane = new JPanel(new BorderLayout());
createPane.add(fontNameComboBox, BorderLayout.NORTH); createPane.add(fontNameComboBox, BorderLayout.NORTH);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, hGapBetweenLeftPaneAndRightPane, LayoutConstants.VGAP_LARGE);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
createPane.add(jPanel, BorderLayout.CENTER); createPane.add(jPanel, BorderLayout.CENTER);
return createPane; return createPane;

4
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java

@ -96,7 +96,7 @@ public class PredefinedStyleBlock extends JPanel {
private void initPane(boolean supportEdit) { private void initPane(boolean supportEdit) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
PredefinedStylePreviewPane content = new PredefinedStylePreviewPane(0.387, 0.384); PredefinedStylePreviewPane content = new PredefinedStylePreviewPane(0.387, 0.384);
content.setPreferredSize(new Dimension(200, 125)); content.setPreferredSize(new Dimension(200, 180));
UILabel label = new UILabel(previewObject.getStyleName()); UILabel label = new UILabel(previewObject.getStyleName());
label.setToolTipText(previewObject.getStyleName()); label.setToolTipText(previewObject.getStyleName());
label.setPreferredSize(new Dimension(167, 25)); label.setPreferredSize(new Dimension(167, 25));
@ -111,7 +111,7 @@ public class PredefinedStyleBlock extends JPanel {
this.add(content, BorderLayout.CENTER); this.add(content, BorderLayout.CENTER);
this.add(panel, BorderLayout.SOUTH); this.add(panel, BorderLayout.SOUTH);
this.setPreferredSize(new Dimension(200, 150)); this.setPreferredSize(new Dimension(200, 210));
panel.setBackground(Color.WHITE); panel.setBackground(Color.WHITE);
this.setBackground(Color.WHITE); this.setBackground(Color.WHITE);
content.refresh(this.previewObject); content.refresh(this.previewObject);

2
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java

@ -94,7 +94,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Overall_Preview")); JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Overall_Preview"));
previewPane = new PredefinedStylePreviewPane(); previewPane = new PredefinedStylePreviewPane();
previewPane.setPreferredSize(new Dimension(517, 320)); previewPane.setPreferredSize(new Dimension(517, 500));
titlePane.add(previewPane); titlePane.add(previewPane);
jPanel.add(titlePane, BorderLayout.CENTER); jPanel.add(titlePane, BorderLayout.CENTER);

6
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSelectPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.predefined.ui; package com.fr.design.mainframe.predefined.ui;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.ChangeListener; import com.fr.design.event.ChangeListener;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -9,9 +9,9 @@ import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.Iterator;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.Iterator;
/** /**
* Created by kerry on 2020-08-26 * Created by kerry on 2020-08-26
@ -51,7 +51,7 @@ public class PredefinedStyleSelectPane extends BasicPane {
contentPane.removeAll(); contentPane.removeAll();
Iterator<PredefinedStyle> iterator = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getPredefinedStyleIterator(); Iterator<PredefinedStyle> iterator = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getPredefinedStyleIterator();
int rowCount = (ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getPredefinedSize() +2)/ 3; int rowCount = (ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getPredefinedSize() +2)/ 3;
contentPane.setPreferredSize(new Dimension(618, 157 * rowCount)); contentPane.setPreferredSize(new Dimension(618, 210 * rowCount));
while (iterator.hasNext()) { while (iterator.hasNext()) {
PredefinedStyle tmpStyle = iterator.next(); PredefinedStyle tmpStyle = iterator.next();

100
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ChartPreStylePreView.java

@ -0,0 +1,100 @@
package com.fr.design.mainframe.predefined.ui.preview;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartPreStyleProvider;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.script.Calculator;
import com.fr.stable.core.PropertyChangeListener;
import java.util.List;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-28
*/
public class ChartPreStylePreView extends MiddleChartComponent {
private ChartCollection chartCollection;
private double scaleX = 1.0;
private double scaleY = 1.0;
private CallbackEvent callbackEvent;
public ChartPreStylePreView() {
}
public ChartPreStylePreView(ChartCollection cc) {
this(cc, 1.0, 1.0);
}
public ChartPreStylePreView(ChartCollection cc, double scaleX, double scaleY) {
this.scaleX = scaleX;
this.scaleY = scaleY;
populate(cc);
}
public void setCallbackEvent(CallbackEvent callbackEvent) {
this.callbackEvent = callbackEvent;
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.translate(ChartConstants.PREGAP4BOUNDS / 2, ChartConstants.PREGAP4BOUNDS / 2);
g2d.scale(scaleX, scaleY);
super.paintComponent(g);
drawChart(g2d);
g2d.scale(1 / scaleX, 1 / scaleY);
g2d.translate(-ChartConstants.PREGAP4BOUNDS / 2, -ChartConstants.PREGAP4BOUNDS / 2);
}
private void drawChart(Graphics2D g2d) {
Dimension d = getBounds().getSize();
int chartWidth = (int) (d.width / scaleX) - ChartConstants.PREGAP4BOUNDS;
int chartHeight = (int) (d.height / scaleX) - ChartConstants.PREGAP4BOUNDS;
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createEmptyDesignerInfo(), chartWidth, chartHeight);
painter.paint(g2d, chartWidth, chartHeight, 0, null, callbackEvent);
}
public void refresh(PredefinedStyle style) {
VanChart vanChart = chartCollection.getSelectedChartProvider(VanChart.class);
List<ChartPreStyleProvider> chartPreStyleProviders = vanChart.getChartPreStyleProvider();
for (ChartPreStyleProvider chartPreStyleProvider : chartPreStyleProviders) {
chartPreStyleProvider.updatePreDefinedStyle(style);
}
vanChart.attrChange();
}
@Override
public void populate(BaseChartCollection cc) {
this.chartCollection = (ChartCollection) cc;
}
@Override
public BaseChartCollection update() {
return this.chartCollection;
}
@Override
public void addStopEditingListener(PropertyChangeListener l) {
}
@Override
public void reset() {
}
}

109
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java

@ -1,26 +1,51 @@
package com.fr.design.mainframe.predefined.ui.preview; package com.fr.design.mainframe.predefined.ui.preview;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.config.predefined.PredefinedStyle; import com.fr.config.predefined.PredefinedStyle;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.Constants;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
/** /**
* Created by kerry on 2020-09-06 * Created by kerry on 2020-09-06
*/ */
public class PredefinedStylePreviewPane extends StyleSettingPreviewPane { public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implements CallbackEvent {
private ElementCasePreview elementCasePreview; private ElementCasePreview elementCasePreview;
private Background background; private Background background;
private double scaleX = 1.0; private double scaleX = 1.0;
private double scaleY = 1.0; private double scaleY = 1.0;
private ChartPreStylePreView columnChartPane;
private ChartPreStylePreView lineChartPane;
private int COLUMN_CHART_WIDTH = 297;
private int COLUMN_CHART_HEIGHT = 220;
public static final double CHART_SCALE = 0.6;
public PredefinedStylePreviewPane() { public PredefinedStylePreviewPane() {
this(1.0, 1.0); this(1.0, 1.0);
@ -31,10 +56,74 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane {
this.scaleY = scaleY; this.scaleY = scaleY;
this.setBackground(Color.WHITE); this.setBackground(Color.WHITE);
this.elementCasePreview = new ElementCasePreview(); this.elementCasePreview = new ElementCasePreview();
this.elementCasePreview.setPreferredSize(new Dimension(517, 320)); this.add(initChartPreViewPane());
this.elementCasePreview.setPreferredSize(new Dimension(517, 250));
this.add(this.elementCasePreview); this.add(this.elementCasePreview);
} }
private JPanel initChartPreViewPane() {
columnChartPane = new ChartPreStylePreView(initVanColumnChart(), CHART_SCALE, CHART_SCALE);
columnChartPane.setPreferredSize(new Dimension(COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT));
columnChartPane.setCallbackEvent(this);
lineChartPane = new ChartPreStylePreView(initVanLineChart(), CHART_SCALE, CHART_SCALE);
lineChartPane.setPreferredSize(new Dimension(220, 220));
lineChartPane.setCallbackEvent(this);
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(columnChartPane);
panel.add(lineChartPane);
return panel;
}
//柱形图
private ChartCollection initVanColumnChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone();
chart.getTitle().setPosition(Constants.LEFT);
VanChartTools vanChartTools = chart.getVanChartTools();
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
VanChartPlot plot = chart.getPlot();
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel();
defaultAttrLabel.setEnable(true);
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0);
defaultAttrLabel.getAttrLabelDetail().getBackground().setBackground(null);
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel);
plot.getLegend().setLegendVisible(false);
plot.getDataSheet().setVisible(true);
ChartCollection chartCollection = new ChartCollection(chart);
return chartCollection;
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return null;
}
//折线图
private ChartCollection initVanLineChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartLinePlot.VAN_CHART_LINE_PLOT)[0].clone();
chart.getTitle().setPosition(Constants.LEFT);
VanChartTools vanChartTools = chart.getVanChartTools();
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
VanChartLinePlot plot = chart.getPlot();
plot.getLegend().setPosition(Constants.TOP);
VanChartAxis defaultXAxis = plot.getDefaultXAxis();
Title title = new Title();
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Category"));
defaultXAxis.setTitle(title);
defaultXAxis.setShowAxisTitle(true);
ChartCollection chartCollection = new ChartCollection(chart);
return chartCollection;
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return null;
}
@Override @Override
public void refresh() { public void refresh() {
@ -50,10 +139,14 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane {
if (background == null) { if (background == null) {
background = ColorBackground.getInstance(Color.WHITE); background = ColorBackground.getInstance(Color.WHITE);
} }
background.paint(g, new Rectangle2D.Double(0, 0, 517, 320)); background.paint(g, new Rectangle2D.Double(0, 0, 517, 500));
this.columnChartPane.paintComponent(g);
g.translate(COLUMN_CHART_WIDTH, 0);
this.lineChartPane.paintComponent(g);
g.translate(-COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT + 10);
this.elementCasePreview.paintContent(g); this.elementCasePreview.paintContent(g);
g.translate(0, -COLUMN_CHART_HEIGHT - 10);
// 恢复双缓冲 // 恢复双缓冲
ComponentUtils.resetBuffer(dbcomponents); ComponentUtils.resetBuffer(dbcomponents);
@ -73,8 +166,14 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane {
public void refresh(PredefinedStyle style, boolean displayFormBackground) { public void refresh(PredefinedStyle style, boolean displayFormBackground) {
elementCasePreview.refresh(style); elementCasePreview.refresh(style);
columnChartPane.refresh(style);
lineChartPane.refresh(style);
background = displayFormBackground ? style.getFormBackground().getBackground() : style.getReportBackground(); background = displayFormBackground ? style.getFormBackground().getBackground() : style.getReportBackground();
this.repaint(); this.repaint();
} }
@Override
public void callback() {
this.repaint();
}
} }

2
designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java

@ -20,5 +20,7 @@ public class TableDataPaneListPaneTest {
listPane.rename("222", "333"); listPane.rename("222", "333");
Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap(); Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap();
assertEquals(1, dsNameChangedMap.size()); assertEquals(1, dsNameChangedMap.size());
listPane.rename("333","111");
assertEquals(0, dsNameChangedMap.size());
} }
} }

6
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -7,6 +7,7 @@ import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo; import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -144,6 +145,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
return; return;
} }
chartCollection4Design.setPredefinedStyleName(getGlobalPredefinedStyleName(), false);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint(); Paint oldPaint = g2d.getPaint();
@ -268,4 +270,8 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
public void callback() { public void callback() {
this.repaint(); this.repaint();
} }
private String getGlobalPredefinedStyleName() {
return HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
}
} }

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

@ -64,11 +64,14 @@ public class VanChartLabelPane extends AbstractVanChartScrollPane<Chart> {
return; return;
} }
ConditionAttr attrList = chart.getPlot().getConditionCollection().getDefaultAttr(); ConditionAttr attrList = chart.getPlot().getConditionCollection().getDefaultAttr();
// labelPane中颜色选择器会触发listener.doChange(),导致style界面update两次,
// 为了避免递归updateBean时,remove与add不匹配,调整一下labelPane.update()的位置
AttrLabel attrLabel = labelPane.update();
DataSeriesCondition attr = ((VanChartPlot)chart.getPlot()).getAttrLabelFromConditionCollection(); DataSeriesCondition attr = ((VanChartPlot)chart.getPlot()).getAttrLabelFromConditionCollection();
if(attr != null) { if(attr != null) {
attrList.remove(attr); attrList.remove(attr);
} }
AttrLabel attrLabel = labelPane.update();
if (attrLabel != null) { if (attrLabel != null) {
attrList.addDataSeriesCondition(attrLabel); attrList.addDataSeriesCondition(attrLabel);
} }

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
@ -58,7 +59,8 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left")
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")}); , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")});
frFontPane = new FRFontPane(); // 字体大小是浮点数,因为涉及很多字体计算,不太好修改,为了完整显示字体,将FRFontPane中的fontSizeComboBox拉长一点
frFontPane = new FRFontPane(LayoutConstants.VGAP_MEDIUM);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p};

15
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -9,6 +9,7 @@ import com.fr.base.PaperSize;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -45,16 +46,19 @@ import com.fr.report.stable.ReportConstants;
import com.fr.report.stable.ReportSettings; import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.AssistUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils; import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils;
import com.fr.third.antlr.ANTLRException; import com.fr.third.antlr.ANTLRException;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
@ -72,9 +76,6 @@ import java.awt.geom.Line2D;
import java.awt.geom.Line2D.Double; import java.awt.geom.Line2D.Double;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class GridUI extends ComponentUI { public class GridUI extends ComponentUI {
@ -512,6 +513,9 @@ public class GridUI extends ComponentUI {
if (tmpCellElement.getStyle() instanceof NameStyle) { if (tmpCellElement.getStyle() instanceof NameStyle) {
((NameStyle) tmpCellElement.getStyle()).setPredefinedStyleName(getGlobalPredefinedStyleName()); ((NameStyle) tmpCellElement.getStyle()).setPredefinedStyleName(getGlobalPredefinedStyleName());
} }
if (tmpCellElement.getValue() instanceof BaseChartCollection) {
((BaseChartCollection) tmpCellElement.getValue()).setPredefinedStyleName(getGlobalPredefinedStyleName(), false);
}
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框 // denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1); painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1);
@ -958,6 +962,9 @@ public class GridUI extends ComponentUI {
g2d.translate(floatX, floatY); g2d.translate(floatX, floatY);
if (tmpFloatElement.getValue() instanceof BaseChartCollection) {
((BaseChartCollection) tmpFloatElement.getValue()).setPredefinedStyleName(getGlobalPredefinedStyleName(), false);
}
PaintUtils.paintFloatElement(g2d, tmpFloatElement, PaintUtils.paintFloatElement(g2d, tmpFloatElement,
tmpFloatElement.getWidth().toPixI(resolution), tmpFloatElement.getWidth().toPixI(resolution),
tmpFloatElement.getHeight().toPixI(resolution), resolution); tmpFloatElement.getHeight().toPixI(resolution), resolution);

Loading…
Cancel
Save