Browse Source

Merge pull request #3236 in DESIGN/design from bugfix/10.0 to release/10.0

* commit '459d49a883d1608e45d557651c6f7d6a5c500996':
  REPORT-46421 取消勾选后 清空下内容
  命名修改
  REPORT-46268 frm中途添加的模板参数,识别不到 发现前面的jwb的几个更新操作其实跟DesignModelAdapter的fireTargetModified()和parameterChanged()重复了,并且parameterChanged()中比上面的jwb的操作还多了个更新ParameterPropertyPane,debug了下发现这也是个必要操作,如果不随着更新会造成一些问题,但是还没有测试测出来,所以其实这里之前就是全量更新的,关于hades说的数据集参数更新的问题,感觉可以后面再提个任务,统一在DesignModelAdapter.getCurrentModelAdapter().parameterChanged()方法中处理
  REPORT-46268 frm中途添加的模板参数,识别不到 【问题原因】过滤条件中的参数是从DesignModelAdapter中拿的,但是frm表单在添加了模板参数之后没有通知DesignModelAdapter更新参数,最初第一个参数p1能拿到的原因是设置了模板参数后,有个添加数据集的操作,而操作了数据集之后会更新DesignModelAdapter中存的参数,所以表现为只能看到p1 【改动思路】在表单添加模板参数的TemplateParameterAction中,添加通知DesignModelAdapter更新参数的逻辑
  REPORT-45775 决策报表参数面板控件可以复制到另一个参数面板--来源【客户需求 510651】
  REPORT-46102 产品改进,水印面板不能直接输入文字,必须在弹出的公式面板下才能编辑
  override
  REPORT-44733【冒烟】附件表单模板的显示会有问题
  REPORT-45880 使用富文本恢复普通文本后文本格式失效
  REPORT-45880 使用富文本恢复普通文本后文本格式失效
  REPORT-45880 使用富文本恢复普通文本后文本格式失效
  REPORT-45473 数据集命名超过16个字符时,关联数据集中不显示数据集名称 【问题原因】之前的逻辑是调用代表数据集名称的UILabel的getPreferredSize()获取width,然后跟常量143去比较,如果超过了143,就将其中内容减短几个字符,加上"...",然后循环接着比较。此时UILabel还没有被添加到panel中,当获取到的width比较贴近143时,添加了之后由于布局变化导致宽度超出143,表现为数据集名称显示丢失 【改动思路】将143缩小为130,差不多是缩小了一个汉字或者两个字母在UILabel中占的宽度,更容易触发判断条件以减短字符然后添加"...",这样UILabel被添加到panel中宽度存在细微变化也不会超过原来的143,数据集名称可以正常显示
  REPORT-44803 清除下之前关闭的pr中的已改动文件
  REPORT-44803 参数面板拖动组件大小右侧不能跟随显示大小--来源【客户需求 508884】 【问题原因】之前的frm缩放的改动——REPORT-37353,把当前的像素值给设置成了组件的x、y值,这样当拖动组件改变大小的时候,x、y不变,右侧也不会变动,因为没有加上组件宽高 【改动思路】为x、y加上当前组件的宽高值
  REPORT-40684 绘制表格辅助线时提前适配合并单元格,去除合并之后使用背景覆盖辅助线的方式
  REPORT-44785 数据集-数据库数据集-视图不能及时更新
  REPORT-45015 条件属性-数字控件没有错误提示
  REPORT-44581 远程连接断开后mac选不到对话框只能重启 【问题原因】"文件保存"界面是一个顶层窗口,客户在进行保存操作的时候,远程服务器突然断开,会触发"连接失败"的提示弹窗,提示弹窗会被"文件保存"界面给覆盖掉,表现为选不到提示弹窗 【改动思路】判断当前父窗口是否为"文件保存"弹窗,如果是的话就作为"连接失败"弹窗的父窗口,而因为确认了提示失败之后会跳出"配置工作目录"界面,仍然会被"文件保存"界面覆盖,所以在"配置工作目录"界面EnvChangeEntrance中增加相应的可以传入父窗口的接口,将"文件保存"传入作为父窗口,这样两个界面都不会被"文件保存"界面覆盖
  REPORT-44596 下拉树控件-急速构建依赖层数自动变化
  REPORT-44581 远程连接断开后mac选不到对话框只能重启 【问题原因】"文件保存"界面是一个顶层窗口,客户在进行保存操作的时候,tomcat突然断开,会触发"连接失败"的提示弹窗,提示弹窗会被"文件保存"界面给覆盖掉,表现为选不到提示弹窗 【改动思路】用一个顶层的空dialog作为"连接失败"弹窗的父窗口,但是因为确认了提示失败之后会跳出"配置工作目录"界面,仍然会被"文件保存"界面覆盖,所以将"配置工作目录"也修改为顶层弹窗(已经测试过"配置工作目录"窗口的二级弹窗并不会因为"配置工作目录"变成顶层弹窗而被覆盖)
feature/big-screen
superman 4 years ago
parent
commit
95d9b4f412
  1. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java
  3. 1
      designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  5. 14
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  6. 10
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  7. 9
      designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java
  8. 4
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  9. 29
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  10. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  11. 331
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  12. 12
      designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java

@ -41,7 +41,7 @@ import java.util.Map.Entry;
public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData> {
private static final int MAX_LENTH_OF_DATASET = 143; //关联数据集面板最大显示的数据集长度,超出这个长度显示数据集名称+“...”
private static final int MAX_LENTH_OF_DATASET = 130; //关联数据集面板最大显示的数据集长度,超出这个长度显示数据集名称+“...”
private static final int MIN_BAR_NUMBER = 10;
private static final int SUB_LENGTH = 4;
private JPanel centerPanel;

4
designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java

@ -99,6 +99,10 @@ public class FormulaEditor extends Editor<BaseFormula> {
return formula;
}
public UITextField getUITextField() {
return currentTextField;
}
/**
* Return the value of the CellEditor.
*/

1
designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java

@ -142,6 +142,7 @@ public class LayerDependenceSettingPane extends JPanel implements ItemListener {
this.model.clear();
this.model.addAll(dependenceList);
this.model.fireTableDataChanged();
}

7
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -106,6 +106,13 @@ public class TableViewList extends UIList {
if (!status) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
schemas = (schemas == null || schemas.length == 0) ? new String[]{null} : schemas;
for (String schema : schemas) {
DataCoreUtils.refreshTables(datasource, TableProcedure.TABLE, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.VIEW, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.PROCEDURE, schema);
}
return processDataInAnotherThread(databaseName, searchFilter, typesFilter);
}

14
designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

@ -1,14 +1,16 @@
package com.fr.design.report;
import com.fr.base.BaseFormula;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.dialog.BasicPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -50,7 +52,7 @@ public class WatermarkPane extends BasicPane {
// 水印预览面板
private WatermarkPreviewPane watermarkPreviewPane;
// 文字
private TinyFormulaPane formulaPane;
private FormulaEditor formulaPane;
// 字号
private UIComboBox fontSizeComboBox;
//横向间距
@ -119,16 +121,16 @@ public class WatermarkPane extends BasicPane {
return watermark;
}
public TinyFormulaPane getFormulaPane() {
public FormulaEditor getFormulaPane() {
return formulaPane;
}
public void setFormulaPane(TinyFormulaPane formulaPane) {
public void setFormulaPane(FormulaEditor formulaPane) {
this.formulaPane = formulaPane;
}
protected UIScrollPane initRightPane() {
formulaPane = new TinyFormulaPane();
formulaPane = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"));
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox.setEditable(true);
horizontalGapSpinner = new UnsignedIntUISpinner(100, Integer.MAX_VALUE, 1, 200);
@ -228,7 +230,7 @@ public class WatermarkPane extends BasicPane {
}
private void populateFourmula(String formula) {
this.formulaPane.populateBean(formula);
this.formulaPane.setValue(BaseFormula.createFormulaBuilder().build(formula));
this.formulaPane.getUITextField().getDocument()
.addDocumentListener(new DocumentListener() {
@Override

10
designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -150,6 +150,7 @@ public class NumberEditorValidatePane extends JPanel {
setMaxListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshErrorMsgTip();
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = (double) 0;
@ -171,6 +172,7 @@ public class NumberEditorValidatePane extends JPanel {
setMinListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshErrorMsgTip();
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = (double) 0;
@ -218,6 +220,14 @@ public class NumberEditorValidatePane extends JPanel {
};
}
private void refreshErrorMsgTip() {
boolean visible = setMaxValueCheckBox.isSelected() || setMinValueCheckBox.isSelected();
errorMsgTextFieldPane.setVisible(visible);
if (!visible) {
errorMsgTextField.setText(StringUtils.EMPTY);
}
}
public void populate(NumberEditor e) {
allowDecimalsCheckBox.setSelected(e.isAllowDecimals());
if (e.isAllowDecimals()) {

9
designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java

@ -2,7 +2,7 @@ package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.base.Parameter;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.DesignModelAdapter;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.JForm;
@ -10,7 +10,7 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.parameter.ParameterArrayPane;
import com.fr.form.main.Form;
import javax.swing.*;
import javax.swing.SwingUtilities;
import java.awt.event.ActionEvent;
/**
@ -48,9 +48,8 @@ public class TemplateParameterAction extends JTemplateAction<JForm> {
for (int i = 0; i < parameters.length; i++) {
wbTpl.addParameter(parameters[i]);
}
jwb.fireTargetModified();
jwb.getFormDesign().setParameterArray(parameters);
jwb.getFormDesign().refreshParameter();
DesignModelAdapter.getCurrentModelAdapter().fireTargetModified();
DesignModelAdapter.getCurrentModelAdapter().parameterChanged();
}
});
parameterArrayDialog.setVisible(true);

4
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -397,8 +397,10 @@ public class SelectionModel {
boolean absoluteCanvas = selectionXCreator.getClass().equals(XWAbsoluteLayout.class);
//选中的是否是相对布局编辑器本身
boolean relativeEditor = selectionXCreator.getClass().equals(XWFitLayout.class);
//选中的参数面板编辑器本身
boolean parameterEditor = selectionXCreator.getClass().equals(XWParameterLayout.class);
return !(tabEditor || absoluteEditor || absoluteCanvas || relativeEditor);
return !(tabEditor || absoluteEditor || absoluteCanvas || relativeEditor || parameterEditor);
} else {
return false;
}

29
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -569,6 +569,35 @@ public class XWAbsoluteLayout extends XLayoutContainer {
}
}
/**
* 重新调整子组件宽度
* @param width 宽度
* @param actualSize 是否按照实际大小计算
*/
@Override
public void recalculateChildWidth(int width, boolean actualSize){
int componentCount = getComponentCount();
for (int i = 0; i < componentCount; i++) {
XCreator creator = (XCreator) getComponent(i);
creator.recalculateChildWidth(width, actualSize);
}
}
/**
* 重新调整子组件高度
* @param height 高度
* @param actualSize 是否按照实际大小计算
*/
@Override
public void recalculateChildHeight(int height, boolean actualSize){
int componentCount = getComponentCount();
for (int i = 0; i < componentCount; i++) {
XCreator creator = (XCreator) getComponent(i);
creator.recalculateChildHeight(height, actualSize);
}
}
/**
* body大小手动调整的时候
* 按照比例调整组件的高度

4
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -180,12 +180,12 @@ public class FormDesignerUI extends ComponentUI {
x1 = 0;
x2 = 6;
y2 = y1 = bounds.y - designer.getVerticalScaleValue() + (k == 1 ? 0 : bounds.height);
text = Utils.objectToString(bounds.y);
text = Utils.objectToString(y1 + designer.getVerticalScaleValue());
} else {
y1 = 0;
y2 = 6;
x1 = x2 = bounds.x - designer.getHorizontalScaleValue()+ (k == 3 ? 0 : bounds.width);
text = Utils.objectToString(bounds.x);
text = Utils.objectToString(x1 + designer.getHorizontalScaleValue());
}
text += com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel");
g2d.setColor(XCreatorConstants.RESIZE_BOX_BORDER_COLOR);

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

@ -49,6 +49,7 @@ import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils;
import com.fr.third.antlr.ANTLRException;
import com.fr.third.guava.collect.HashMultimap;
import javax.swing.JComponent;
import javax.swing.UIManager;
@ -73,6 +74,7 @@ import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
public class GridUI extends ComponentUI {
@ -91,6 +93,7 @@ public class GridUI extends ComponentUI {
protected List paintCellElementList = new ArrayList();
protected List paintCellElementRectangleList = new ArrayList();
protected List paginateLineList = new ArrayList(); // 分页线
protected HashMultimap<CellPosition, Integer> mergeCellElementTable = HashMultimap.create();
// 为了画白色的背景.
protected static Background WHITE_Backgorund = ColorBackground.getInstance(Color.WHITE);
// CellElementPainter
@ -247,7 +250,7 @@ public class GridUI extends ComponentUI {
- reportSettings.getFooterHeight().toPixD(resolution);
}
private void paintGridLine(Graphics g, Grid grid, double realWidth, double realHeight,
private void paintGridLine(Graphics g, Grid grid, TemplateElementCase report, double realWidth, double realHeight,
int resolution) {
Graphics2D g2d = (Graphics2D) g;
@ -257,22 +260,51 @@ public class GridUI extends ComponentUI {
// 分页线
paginateLineList.clear();
// 合并单元格
mergeCellElementTable.clear();
boolean isShowVerticalPaginateLine = grid.getPaginateLineShowType() == Grid.MULTIPLE_PAGINATE_LINE;
boolean isShowHorizontalPaginateLine = grid.getPaginateLineShowType() != Grid.NO_PAGINATE_LINE;
new DrawVerticalLineHelper(grid.getVerticalBeginValue(), verticalEndValue,
grid.isShowGridLine(), isShowVerticalPaginateLine, rowHeightList, paperPaintHeight,
paginateLineList, realWidth, resolution).iterateStart2End(g2d);
Iterator cells = report.intersect(grid.getHorizontalBeginValue(), grid.getVerticalBeginValue(),
horizontalEndValue - grid.getHorizontalBeginValue(), verticalEndValue - grid.getVerticalBeginValue());
while (cells.hasNext()) {
TemplateCellElement cellElement = (TemplateCellElement) cells.next();
if (cellElement == null) {
continue;
}
int columnSpan = cellElement.getColumnSpan();
int rowSpan = cellElement.getRowSpan();
if (columnSpan > 1 || rowSpan > 1) {
for (int c = 0; c < columnSpan - 1; c++) {
for (int r = 0; r < rowSpan; r++) {
mergeCellElementTable.put(CellPosition.value(cellElement.getRow() + r, cellElement.getColumn() + c), CellPosition.RIGHT);
}
}
for (int r = 0; r < rowSpan - 1; r++) {
for (int c = 0; c < columnSpan; c++) {
mergeCellElementTable.put(CellPosition.value(cellElement.getRow() + r, cellElement.getColumn() + c), CellPosition.BOTTOM);
}
}
}
}
GridRange gridRange = GridRange.range(grid.getHorizontalBeginValue(), horizontalEndValue, grid.getVerticalBeginValue(), verticalEndValue)
.rangeList(rowHeightList, columnWidthList)
.realSize(realWidth, realHeight);
new DrawHorizontalLineHelper(grid.getHorizontalBeginValue(), horizontalEndValue,
grid.isShowGridLine(), isShowHorizontalPaginateLine, columnWidthList, paperPaintWidth,
paginateLineList, realHeight, resolution).iterateStart2End(g2d);
new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(),
isShowVerticalPaginateLine, paperPaintHeight,
paginateLineList, resolution).iterateStart2End(g2d);
new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(),
isShowHorizontalPaginateLine, paperPaintWidth,
paginateLineList, resolution).iterateStart2End(g2d);
}
/**
* 最后处理
*/
@Override
public void finalize() {
try {
super.finalize();
@ -285,80 +317,34 @@ public class GridUI extends ComponentUI {
}
private static abstract class DrawLineHelper {
private int startIndex;
private int endIndex;
protected GridRange gridRange;
private boolean showGridLine;
private boolean showPaginateLine;
protected boolean showGridLine;
protected boolean showPaginateLine;
private DynamicUnitList sizeList;
private double paperPaintSize;
protected double paperPaintSize;
private List paginateLineList;
protected List paginateLineList;
Line2D tmpLine2D = new Line2D.Double(0, 0, 0, 0);
private int resolution;
protected int resolution;
private static final double THRESHOLD = 1.0E-4D;
protected static final double THRESHOLD = 1.0E-4D;
DrawLineHelper(int startIndex, int endIndex, boolean showGridLine,
boolean showPaginateLine, DynamicUnitList sizeList, double paperPaintSize,
DrawLineHelper(GridRange gridRange, boolean showGridLine,
boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) {
this.startIndex = startIndex;
this.endIndex = endIndex;
this.gridRange = gridRange;
this.showGridLine = showGridLine;
this.showPaginateLine = showPaginateLine;
this.sizeList = sizeList;
this.paperPaintSize = paperPaintSize;
this.paginateLineList = paginateLineList;
this.resolution = resolution;
}
protected void iterateStart2End(Graphics2D g2d) {
float tmpSize = 0, paperSumSize = 0, sumSize = 0;
for (int i = 0; i <= endIndex; i++) {
// denny: 开始
if (i == 0) {
i = startIndex;
// denny: 增加从0到Grid左边被hide的列宽
for (int k = 0; k < startIndex; k++) {
tmpSize = sizeList.get(k).toPixF(resolution);
paperSumSize += tmpSize;
if (paperSumSize >= paperPaintSize) {
paperSumSize = tmpSize;
}
}
}
// adjust height.
tmpSize = sizeList.get(i).toPixF(resolution);
paperSumSize += tmpSize;
if (showGridLine) {// paint line.
setLine2D((int) sumSize);
g2d.draw(tmpLine2D);
}
// paint paper margin line.
if (showPaginateLine && paperSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) sumSize));
paperSumSize = tmpSize;
}
sumSize += tmpSize;
}
// paint 最后一个横线..
if (showGridLine) {
drawLastLine(g2d, (int) sumSize);
}
}
protected abstract void setLine2D(int sumSize);
protected abstract void iterateStart2End(Graphics2D g2d);
protected abstract Line2D.Double getPaginateLine2D(int sumSize);
@ -366,14 +352,12 @@ public class GridUI extends ComponentUI {
}
private class DrawVerticalLineHelper extends DrawLineHelper {
private double realWidth;
DrawVerticalLineHelper(int startIndex, int endIndex, boolean showGridLine,
boolean showPaginateLine, DynamicUnitList unitSizeList, double paperPaintSize,
List paginateLineList, double realWidth, int resolution) {
super(startIndex, endIndex, showGridLine, showPaginateLine, unitSizeList,
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine,
boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution);
this.realWidth = realWidth;
}
@Override
@ -382,25 +366,58 @@ public class GridUI extends ComponentUI {
}
@Override
protected void setLine2D(int sumHeight) {
tmpLine2D.setLine(0, sumHeight, realWidth, sumHeight);
protected void drawLastLine(Graphics2D g2d, int sumHeight) {
GraphHelper.drawLine(g2d, 0, sumHeight, gridRange.realWidth, sumHeight);
}
@Override
protected void drawLastLine(Graphics2D g2d, int sumHeight) {
GraphHelper.drawLine(g2d, 0, sumHeight, realWidth, sumHeight);
protected void iterateStart2End(Graphics2D g2d) {
float rowHeight, paperYAxisSumSize = 0, yAxisSumSize = 0;
for (int i = 0; i <= gridRange.yEndIndex; i++) {
if (i == 0) {
i = gridRange.yBeginIndex;
for (int k = 0; k < gridRange.yBeginIndex; k++) {
rowHeight = gridRange.rowHeightList.get(k).toPixF(resolution);
paperYAxisSumSize += rowHeight;
if (paperYAxisSumSize >= paperPaintSize) {
paperYAxisSumSize = rowHeight;
}
}
}
rowHeight = gridRange.rowHeightList.get(i).toPixF(resolution);
paperYAxisSumSize += rowHeight;
if (showGridLine) {
float columnWidth, xAxisSumSize = 0;
for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) {
columnWidth = gridRange.columnWidthList.get(j).toPixF(resolution);
if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize + columnWidth, yAxisSumSize);
g2d.draw(tmpLine2D);
}
xAxisSumSize += columnWidth;
}
}
if (showPaginateLine && paperYAxisSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize));
paperYAxisSumSize = rowHeight;
}
yAxisSumSize += rowHeight;
}
// paint 最后一个横线..
if (showGridLine) {
drawLastLine(g2d, (int) yAxisSumSize);
}
}
}
private class DrawHorizontalLineHelper extends DrawLineHelper {
private double realHeight;
DrawHorizontalLineHelper(int startIndex, int endIndex, boolean showGridLine,
boolean showPaginateLine, DynamicUnitList unitSizeList, double paperPaintSize,
List paginateLineList, double realHeight, int resolution) {
super(startIndex, endIndex, showGridLine, showPaginateLine, unitSizeList,
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine,
boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution);
this.realHeight = realHeight;
}
@Override
@ -409,13 +426,47 @@ public class GridUI extends ComponentUI {
}
@Override
protected void setLine2D(int sumWidth) {
tmpLine2D.setLine(sumWidth, 0, sumWidth, realHeight);
protected void drawLastLine(Graphics2D g2d, int sumWidth) {
GraphHelper.drawLine(g2d, sumWidth, 0, sumWidth, gridRange.realHeight);
}
@Override
protected void drawLastLine(Graphics2D g2d, int sumWidth) {
GraphHelper.drawLine(g2d, sumWidth, 0, sumWidth, realHeight);
protected void iterateStart2End(Graphics2D g2d) {
float columnWidth, paperXAxisSumSize = 0, xAxisSumSize = 0;
for (int i = 0; i <= gridRange.xEndIndex; i++) {
if (i == 0) {
i = gridRange.xBeginIndex;
for (int k = 0; k < gridRange.xBeginIndex; k++) {
columnWidth = gridRange.columnWidthList.get(k).toPixF(resolution);
paperXAxisSumSize += columnWidth;
if (paperXAxisSumSize >= paperPaintSize) {
paperXAxisSumSize = columnWidth;
}
}
}
columnWidth = gridRange.columnWidthList.get(i).toPixF(resolution);
paperXAxisSumSize += columnWidth;
if (showGridLine) {
float rowHeight, yAxisSumSize = 0;
for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) {
rowHeight = gridRange.rowHeightList.get(j).toPixF(resolution);
if (!mergeCellElementTable.get(CellPosition.value(j, i - 1)).contains(CellPosition.RIGHT)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize, yAxisSumSize + rowHeight);
g2d.draw(tmpLine2D);
}
yAxisSumSize += rowHeight;
}
}
if (showPaginateLine && paperXAxisSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize));
paperXAxisSumSize = columnWidth;
}
xAxisSumSize += columnWidth;
}
// paint 最后一个横线..
if (showGridLine) {
drawLastLine(g2d, (int) xAxisSumSize);
}
}
}
@ -482,18 +533,6 @@ public class GridUI extends ComponentUI {
// peter:tmpRectangle2D_3只是一个临时的Rectangle2D,由于后面不少地方需要用到这个矩形
this.cell_back_rect.setRect(0, 0, this.tmpRectangle.getWidth() - 1,
this.tmpRectangle.getHeight() - 1.5);
// peter:对于合并的单元格,需要先白色的背景来清除背景.
if (tmpCellElement.getColumnSpan() > 1 || tmpCellElement.getRowSpan() > 1) {
// REPORT-23492 要看下是否设置了纸张背景 如果设置了按照背景来画
ReportSettingsProvider reportSettings = getReportSettings(report);
Background currentBackground = reportSettings.getBackground();
if (currentBackground != null) {
currentBackground.paint(g2d, this.cell_back_rect);
} else {
WHITE_Backgorund.paint(g2d, this.cell_back_rect);
}
//daniel:上面这里就有问题了啊....报表的背景在这个之前画的 会覆盖报表背景....不过只是设计器中看到预览浏览没问题
}
// peter:将这个元素添加到需要paint的元素列表当中去,留着画边框线..
paintCellElementList.add(tmpCellElement);
paintCellElementRectangleList.add(this.tmpRectangle.clone());
@ -1093,8 +1132,7 @@ public class GridUI extends ComponentUI {
this.paintBackground(g2d, grid, elementCase, resolution);
// 画Grid Line
this.paintGridLine(g2d, grid, realWidth, realHeight, resolution);
this.paintGridLine(g2d, grid, elementCase, realWidth, realHeight, resolution);
// peter:添上线程的支持,有时候,paint元素的时候,可能会有元素被删除了.
// 需要先清除画Border需要的元素.
paintCellElementList.clear();
@ -1277,4 +1315,101 @@ public class GridUI extends ComponentUI {
paginateLineList.add(new Line2D.Double(0, sumHeight, width, sumHeight));
}
}
/**
* 描述单元格位置的POJO
*/
private static class CellPosition {
public final static int TOP = 0;
public static final int LEFT = 1;
public final static int BOTTOM = 2;
public static final int RIGHT = 4;
public int x;
public int y;
public CellPosition(int x, int y) {
this.x = x;
this.y = y;
}
public static CellPosition value(int x, int y) {
return new CellPosition(x, y);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CellPosition that = (CellPosition) o;
return x == that.x && y == that.y;
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
}
/**
* 描述表格范围的POJO
* x轴为水平方向对应的宽度表为列宽列表
* y轴为垂直方向对应的宽度表为行高列表
*/
private static class GridRange {
public int xBeginIndex;
public int xEndIndex;
public int yBeginIndex;
public int yEndIndex;
double realWidth;
double realHeight;
/**
* 行高列表对应y方向线段
*/
public DynamicUnitList rowHeightList;
/**
* 列宽列表对应x方向线段
*/
public DynamicUnitList columnWidthList;
public GridRange(int xBeginIndex, int xEndIndex, int yBeginIndex, int yEndIndex) {
this.xBeginIndex = xBeginIndex;
this.xEndIndex = xEndIndex;
this.yBeginIndex = yBeginIndex;
this.yEndIndex = yEndIndex;
}
/**
* 设置行高列宽列表
*
* @param rowHeightList 行高列表
* @param columnWidthList 列宽列表
*/
public GridRange rangeList(DynamicUnitList rowHeightList, DynamicUnitList columnWidthList) {
this.rowHeightList = rowHeightList;
this.columnWidthList = columnWidthList;
return this;
}
/**
* 设置表格真实宽高
*
* @param realWidth 宽度
* @param realHeight 高度
*/
public GridRange realSize(double realWidth, double realHeight) {
this.realWidth = realWidth;
this.realHeight = realHeight;
return this;
}
public static GridRange range(int xBeginIndex, int xEndIndex, int yBeginIndex, int yEndIndex) {
return new GridRange(xBeginIndex, xEndIndex, yBeginIndex, yEndIndex);
}
}
}

12
designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java

@ -573,6 +573,7 @@ public class CellSelection extends Selection {
for (int i = 0; i < removeElementList.size(); i++) {
CellElement element = removeElementList.get(i);
element.setValue(null);
setDefault(element);
}
break;
@ -588,6 +589,17 @@ public class CellSelection extends Selection {
return true;
}
//设置显示内容为default
private void setDefault(CellElement element) {
CellGUIAttr cellGUIAttr = element.getCellGUIAttr();
if (cellGUIAttr != null) {
cellGUIAttr.setShowAsDefault(true);
cellGUIAttr.setShowAsHTML(false);
cellGUIAttr.setShowAsDownload(false);
cellGUIAttr.setShowAsImage(false);
}
}
@Override
public int[] getSelectedColumns() {

Loading…
Cancel
Save