Browse Source

Pull request #10238: REPORT-81307 A列列宽概率显示为B列列宽值

Merge in DESIGN/design from ~DESTINY.LIN/design:feature/x to feature/x

* commit '7cca9c2f571cd69bfd16910f14cd150a54041cbd':
  REPORT-81307 补充注释
  REPORT-81307 A列列宽概率显示为B列列宽值
  REPORT-81307 A列列宽概率显示为B列列宽值
feature/x
Destiny.Lin-林锦龙 2 years ago
parent
commit
33a1297683
  1. 22
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

22
designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -38,6 +38,8 @@ import java.lang.reflect.Method;
public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
protected static final int FUZZY_EDGE = 10; protected static final int FUZZY_EDGE = 10;
protected static final int SEPARATOR_GAP = 5; protected static final int SEPARATOR_GAP = 5;
//只选中一个
private static final int ONLY_SELECT_ONE = 1;
protected GridHeader gHeader; protected GridHeader gHeader;
private int dragType = GridUtils.DRAG_NONE; private int dragType = GridUtils.DRAG_NONE;
@ -109,7 +111,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (between(evt, tmpSize1, tmpSize2)) { if (between(evt, tmpSize1, tmpSize2)) {
if (index >= dragIndex) { if (index >= dragIndex) {
try { try {
if(method != null) { if (method != null) {
method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution));
} }
} catch (Exception e) { } catch (Exception e) {
@ -118,7 +120,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
//sizeList.set(dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); //sizeList.set(dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution));
} else { } else {
try { try {
if(method != null) { if (method != null) {
method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution)); method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution));
} }
} catch (Exception e) { } catch (Exception e) {
@ -128,7 +130,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
// from all to do. // from all to do.
for (int h = (dragIndex - 1); h > index; h--) { for (int h = (dragIndex - 1); h > index; h--) {
try { try {
if(method != null) { if (method != null) {
method.invoke(report, h, UNIT.ZERO); method.invoke(report, h, UNIT.ZERO);
} }
} catch (Exception e) { } catch (Exception e) {
@ -219,7 +221,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
ePane.getGrid().stopEditing();// james 停止当前的所有编辑 ePane.getGrid().stopEditing();// james 停止当前的所有编辑
// peter:选中格子位置. // peter:选中格子位置.
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(),resolution); ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(), resolution);
iterateScrollBar(ePane, evt, PRESS_ACTION); iterateScrollBar(ePane, evt, PRESS_ACTION);
@ -227,7 +229,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (SwingUtilities.isRightMouseButton(evt)) { if (SwingUtilities.isRightMouseButton(evt)) {
Selection cs = ePane.getSelection(); Selection cs = ePane.getSelection();
resetSelectionByRightButton(selectedCellPoint, cs, ePane); resetSelectionByRightButton(selectedCellPoint, cs, ePane);
checkEndMultiSelectIndex(cs);
UIPopupMenu popupMenu = createPopupMenu(ePane, evt, Math.max(dragIndex, Math.max(this.startMultiSelectIndex, this.endMultiSelectIndex))); UIPopupMenu popupMenu = createPopupMenu(ePane, evt, Math.max(dragIndex, Math.max(this.startMultiSelectIndex, this.endMultiSelectIndex)));
if (popupMenu != null) { if (popupMenu != null) {
GUICoreUtils.showPopupMenu(popupMenu, gHeader, evt.getX() + 1, evt.getY() + 1); GUICoreUtils.showPopupMenu(popupMenu, gHeader, evt.getX() + 1, evt.getY() + 1);
@ -246,6 +248,16 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
ePane.repaint(); ePane.repaint();
} }
/**
* 如果行列中有只选中一个的情况更新下endIndex防止列宽或行宽不匹配
* @param selection 与ElementCasePane绑定的选择对象
*/
private void checkEndMultiSelectIndex(Selection selection) {
if (selection.getSelectedColumns().length == ONLY_SELECT_ONE || selection.getSelectedRows().length == ONLY_SELECT_ONE) {
this.endMultiSelectIndex = this.startMultiSelectIndex;
}
}
protected abstract void resetSelectionByRightButton(ColumnRow mouseSelectedColumnRow, Selection cs, ElementCasePane ePane); protected abstract void resetSelectionByRightButton(ColumnRow mouseSelectedColumnRow, Selection cs, ElementCasePane ePane);

Loading…
Cancel
Save