Browse Source

Merge pull request #4954 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '18b0c1e6d86cf8378e93ce7759d61b4021fec99a':
  REPORT-54998 去除多余的常量
  REPORT-54998 进一步优化代码,去除具体的方向判断,只留水平或者垂直。
  REPORT-54998 完善代码逻辑
  REPORT-54998 完善代码逻辑
  REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置
  REPORT-55034 聚合报表,单元格属性设置面板,在切换参数面板编辑后,面板未刷新
  REPORT-54998 修正一下命名
  REPORT-54998 完善一下这边的判断逻辑,使其更加清晰
  REPORT-54998 修正数字拓展不正确的问题
  REPORT-54998 设计器单元格右下角‘十’拖动,向右向下正常,向左无法递减,向上无法操作
feature/10.0
superman 3 years ago
parent
commit
85e914f0c2
  1. 14
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  2. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  3. 83
      designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java
  4. 60
      designer-realize/src/main/java/com/fr/grid/IntelliElements.java

14
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -780,6 +780,17 @@ public class XWFitLayout extends XLayoutContainer {
tabLayout.updateBoundsWidget();
}
}
}
layout.setContainerHeight(containerHeight);
layout.setContainerWidth(containerWidth);
addCompInterval(getAcualInterval());
// REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置
// 绝对布局内的组件尺寸调整需要在绝对布局的bound排除GAP后进行,否则计算出的
// 组件尺寸缩放比例会有问题
for (int index = 0, n = this.getComponentCount(); index < n; index++) {
XCreator creator = (XCreator) this.getComponent(index);
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
//如果子组件是绝对布局,则内部的widget也要更新
if (creator.acceptType(XWAbsoluteLayout.class)){
//更新的时候一定要带上backupBound
@ -790,9 +801,6 @@ public class XWFitLayout extends XLayoutContainer {
creator.setBackupBound(creator.getBounds());
}
}
layout.setContainerHeight(containerHeight);
layout.setContainerWidth(containerWidth);
addCompInterval(getAcualInterval());
}
private Rectangle recalculateWidgetBounds(Rectangle rec, int[] hors, int[] veris) {

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

@ -1019,6 +1019,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
// EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
QuickEditorRegion.getInstance().populate(QuickEditor.DEFAULT_EDITOR);
} else {
if (polyDesigner.getSelectionType() == PolyDesigner.SelectionType.INNER) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
}
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
}
EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance());

83
designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java

@ -501,54 +501,59 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private void doWithCellElementDragged(int evtX, int evtY, CellSelection cs) {
ElementCasePane reportPane = grid.getElementCasePane();
java.awt.Rectangle cellRectangle = cs.toRectangle();
java.awt.Rectangle startRec = cs.toRectangle();
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) {
grid.getDragRectangle().setBounds(cellRectangle);
} else {
int xDistance = evtX - this.oldEvtX;
int yDistance = evtY - this.oldEvtY;
if (Math.abs(yDistance) > Math.abs(xDistance)) {
grid.getDragRectangle().x = cellRectangle.x;
grid.getDragRectangle().width = cellRectangle.width;
if (yDistance >= 0) {
// 聚合报表要求拖拽的时候要在本块的内部进行 不能无限往下拖
if (reportPane instanceof ECBlockPane && evtY > reportPane.getBounds().height - ECBlockGap) {
ColumnRow currentMouseCell = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (isOutECBlockPane(evtX, evtY)) {
return;
}
grid.getDragRectangle().y = cellRectangle.y;
grid.getDragRectangle().height = selectedCellPoint.getRow() - cellRectangle.y + 1;
} else {
if (selectedCellPoint.getRow() >= cellRectangle.y && selectedCellPoint.getRow() < cellRectangle.y + cellRectangle.height) {
grid.getDragRectangle().y = cellRectangle.y;
grid.getDragRectangle().height = cellRectangle.height;
} else {
grid.getDragRectangle().y = cellRectangle.y;
grid.getDragRectangle().height = cellRectangle.y - selectedCellPoint.getRow() + cellRectangle.height;
}
int xDistance = evtX - this.oldEvtX;
int yDistance = evtY - this.oldEvtY;
boolean isHorizontal = isHorizontal(xDistance, yDistance);
Rectangle endRec = calculateEndRec(currentMouseCell, startRec, isHorizontal);
grid.getDragRectangle().setBounds(calculateDragRectangle(startRec, endRec));
reportPane.ensureColumnRowVisible(currentMouseCell.getColumn() + 1, currentMouseCell.getRow() + 1);
}
} else {
grid.getDragRectangle().y = cellRectangle.y;
grid.getDragRectangle().height = cellRectangle.height;
if (xDistance >= 0) {
if (reportPane instanceof ECBlockPane && evtX > reportPane.getBounds().width - ECBlockGap) {
return;
private boolean isHorizontal(int xDistance, int yDistance) {
return Math.abs(yDistance) <= Math.abs(xDistance);
}
grid.getDragRectangle().x = cellRectangle.x;
grid.getDragRectangle().width = selectedCellPoint.getColumn() - cellRectangle.x + 1;
} else {
if (selectedCellPoint.getColumn() >= cellRectangle.x && selectedCellPoint.getColumn() < cellRectangle.x + cellRectangle.width) {
grid.getDragRectangle().x = cellRectangle.x;
grid.getDragRectangle().width = cellRectangle.width;
/**
* 计算拖拽的结尾矩形
* @param currentMouseCell 当前鼠标所在的格子
* @param startRec 起始格子
* @param isHorizontal 拖拽方向 水平or垂直
* @return 计算拖拽的结尾矩形
*/
private Rectangle calculateEndRec(ColumnRow currentMouseCell, Rectangle startRec, boolean isHorizontal) {
if (isHorizontal) {
return new Rectangle(currentMouseCell.column, startRec.y, 1, 1);
} else {
grid.getDragRectangle().x = selectedCellPoint.getColumn();
grid.getDragRectangle().width = cellRectangle.x - selectedCellPoint.getColumn() + cellRectangle.width;
}
return new Rectangle(startRec.x, currentMouseCell.row, 1, 1);
}
}
/**
* 计算拖拽的边框传俩矩形确认出一个大矩形就是所要的结果
* @param startRec 起始格子矩形
* @param endRec 结尾格子矩形
* @return 拖拽的边框
*/
private Rectangle calculateDragRectangle(Rectangle startRec, Rectangle endRec) {
Rectangle rectangle = new Rectangle();
int x = Math.min(startRec.x, endRec.x);
int y = Math.min(startRec.y, endRec.y);
int rightBottomX = Math.max(startRec.x + startRec.width, endRec.x + endRec.width);
int rightBottomY = Math.max(startRec.y + startRec.height, endRec.y + endRec.height);
rectangle.setBounds(x, y, rightBottomX - x, rightBottomY - y);
return rectangle;
}
reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn() + 1, selectedCellPoint.getRow() + 1);
private boolean isOutECBlockPane(int evtX, int evtY) {
ElementCasePane reportPane = grid.getElementCasePane();
return reportPane instanceof ECBlockPane && ((evtY > reportPane.getBounds().height - ECBlockGap) || (evtX > reportPane.getBounds().width - ECBlockGap));
}
private void doShiftSelectCell(double evtX, double evtY) {

60
designer-realize/src/main/java/com/fr/grid/IntelliElements.java

@ -183,9 +183,9 @@ public class IntelliElements {
}
public void doIntelliAction() {
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex++) {
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex++) {
public abstract void doIntelliAction();
public void expandCellValue(int colIndex, int rowIndex) {
TemplateCellElement sourceCellElement = getSourceCellElementByColumnRow(colIndex, rowIndex);
if (sourceCellElement == null) {
@ -218,8 +218,6 @@ public class IntelliElements {
report.addCellElement(newCellElement);
}
}
}
protected abstract int getStartColumnIndex();
@ -328,6 +326,15 @@ public class IntelliElements {
};
}
@Override
public void doIntelliAction() {
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex ++) {
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) {
expandCellValue(colIndex, rowIndex);
}
}
}
@Override
public boolean havetoModify() {
return IntelliElements.this.dragCellRectangle.width > IntelliElements.this.oldCellRectangle.width;
@ -397,6 +404,15 @@ public class IntelliElements {
};
}
@Override
public void doIntelliAction() {
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex > colEnd; colIndex --) {
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) {
expandCellValue(colIndex, rowIndex);
}
}
}
@Override
public boolean havetoModify() {
return true;
@ -414,22 +430,22 @@ public class IntelliElements {
@Override
public int getStartColumnIndex() {
return IntelliElements.this.dragCellRectangle.x;
return IntelliElements.this.oldCellRectangle.x - 1;
}
@Override
public int getEndColumnIndex() {
return IntelliElements.this.oldCellRectangle.x;
return IntelliElements.this.dragCellRectangle.x - 1;
}
@Override
public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) {
return report.getTemplateCellElement(IntelliElements.this.oldCellRectangle.x + (columnIndex - IntelliElements.this.dragCellRectangle.x) % (IntelliElements.this.oldCellRectangle.width), rowIndex);
return report.getTemplateCellElement(columnIndex + IntelliElements.this.oldCellRectangle.width, rowIndex);
}
@Override
protected Number processNumber(Number i) {
return i;
return FunctionHelper.asNumber(i.doubleValue() - 1);
}
@Override
@ -465,6 +481,15 @@ public class IntelliElements {
};
}
@Override
public void doIntelliAction() {
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex ++) {
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) {
expandCellValue(colIndex, rowIndex);
}
}
}
@Override
public boolean havetoModify() {
return IntelliElements.this.dragCellRectangle.height > IntelliElements.this.oldCellRectangle.height;
@ -533,6 +558,15 @@ public class IntelliElements {
};
}
@Override
public void doIntelliAction() {
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex++) {
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex > rowEnd; rowIndex--) {
expandCellValue(colIndex, rowIndex);
}
}
}
@Override
public boolean havetoModify() {
return true;
@ -540,12 +574,12 @@ public class IntelliElements {
@Override
public int getStartRowIndex() {
return IntelliElements.this.dragCellRectangle.y;
return IntelliElements.this.oldCellRectangle.y - 1;
}
@Override
public int getEndRowIndex() {
return IntelliElements.this.oldCellRectangle.y;
return IntelliElements.this.dragCellRectangle.y - 1;
}
@Override
@ -560,12 +594,12 @@ public class IntelliElements {
@Override
public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) {
return report.getTemplateCellElement(columnIndex, IntelliElements.this.oldCellRectangle.y + (rowIndex - IntelliElements.this.dragCellRectangle.y) % (IntelliElements.this.oldCellRectangle.height));
return report.getTemplateCellElement(columnIndex, rowIndex + IntelliElements.this.oldCellRectangle.height);
}
@Override
protected Number processNumber(Number i) {
return i;
return FunctionHelper.asNumber(i.doubleValue() - 1);
}
@Override

Loading…
Cancel
Save