Browse Source

Merge pull request #10273 in DESIGN/design from feature/10.0 to feature/big-screen

* commit 'dbbbf5a3ee09db0f5d496ec2fff002b3ea46e4d3':
  REPORT-81307 A列列宽概率显示为B列列宽值
feature/big-screen
superman 2 years ago
parent
commit
8c0f7820bb
  1. 16
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

16
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 SEPARATOR_GAP = 5; protected static final int SEPARATOR_GAP = 5;
//只选中一个
private static final int ONLY_SELECT_ONE = 1;
private GridHeader gHeader; private GridHeader gHeader;
private int dragType = GridUtils.DRAG_NONE; private int dragType = GridUtils.DRAG_NONE;
@ -231,7 +233,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);
@ -250,6 +252,18 @@ 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