Browse Source

REPORT-54998 设计器单元格右下角‘十’拖动,向右向下正常,向左无法递减,向上无法操作

zheng-1641779399395
方磊 3 years ago
parent
commit
b8f32bf0a0
  1. 2
      designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java
  2. 56
      designer-realize/src/main/java/com/fr/grid/IntelliElements.java

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

@ -474,7 +474,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
grid.getDragRectangle().y = cellRectangle.y; grid.getDragRectangle().y = cellRectangle.y;
grid.getDragRectangle().height = cellRectangle.height; grid.getDragRectangle().height = cellRectangle.height;
} else { } else {
grid.getDragRectangle().y = cellRectangle.y; grid.getDragRectangle().y = selectedCellPoint.getRow();
grid.getDragRectangle().height = cellRectangle.y - selectedCellPoint.getRow() + cellRectangle.height; grid.getDragRectangle().height = cellRectangle.y - selectedCellPoint.getRow() + cellRectangle.height;
} }
} }

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

@ -183,9 +183,9 @@ public class IntelliElements {
} }
public void doIntelliAction() { public abstract void doIntelliAction();
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex++) {
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex++) { public void expandCellValue(int colIndex, int rowIndex) {
TemplateCellElement sourceCellElement = getSourceCellElementByColumnRow(colIndex, rowIndex); TemplateCellElement sourceCellElement = getSourceCellElementByColumnRow(colIndex, rowIndex);
if (sourceCellElement == null) { if (sourceCellElement == null) {
@ -218,8 +218,6 @@ public class IntelliElements {
report.addCellElement(newCellElement); report.addCellElement(newCellElement);
} }
}
}
protected abstract int getStartColumnIndex(); 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 @Override
public boolean havetoModify() { public boolean havetoModify() {
return IntelliElements.this.dragCellRectangle.width > IntelliElements.this.oldCellRectangle.width; 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 @Override
public boolean havetoModify() { public boolean havetoModify() {
return true; return true;
@ -414,17 +430,17 @@ public class IntelliElements {
@Override @Override
public int getStartColumnIndex() { public int getStartColumnIndex() {
return IntelliElements.this.dragCellRectangle.x; return IntelliElements.this.oldCellRectangle.x - 1;
} }
@Override @Override
public int getEndColumnIndex() { public int getEndColumnIndex() {
return IntelliElements.this.oldCellRectangle.x; return IntelliElements.this.dragCellRectangle.x - 1;
} }
@Override @Override
public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) { 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 @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 @Override
public boolean havetoModify() { public boolean havetoModify() {
return IntelliElements.this.dragCellRectangle.height > IntelliElements.this.oldCellRectangle.height; 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 @Override
public boolean havetoModify() { public boolean havetoModify() {
return true; return true;
@ -540,12 +574,12 @@ public class IntelliElements {
@Override @Override
public int getStartRowIndex() { public int getStartRowIndex() {
return IntelliElements.this.dragCellRectangle.y; return IntelliElements.this.oldCellRectangle.y - 1;
} }
@Override @Override
public int getEndRowIndex() { public int getEndRowIndex() {
return IntelliElements.this.oldCellRectangle.y; return IntelliElements.this.dragCellRectangle.y - 1;
} }
@Override @Override
@ -560,7 +594,7 @@ public class IntelliElements {
@Override @Override
public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) { 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 @Override

Loading…
Cancel
Save