|
|
|
@ -38,6 +38,8 @@ import java.lang.reflect.Method;
|
|
|
|
|
*/ |
|
|
|
|
public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { |
|
|
|
|
protected static final int SEPARATOR_GAP = 5; |
|
|
|
|
//只选中一个
|
|
|
|
|
private static final int ONLY_SELECT_ONE = 1; |
|
|
|
|
|
|
|
|
|
private GridHeader gHeader; |
|
|
|
|
private int dragType = GridUtils.DRAG_NONE; |
|
|
|
@ -55,10 +57,10 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
|
|
|
|
|
public AbstractGridHeaderMouseHandler(GridHeader gHeader) { |
|
|
|
|
this.gHeader = gHeader; |
|
|
|
|
if (gHeader instanceof GridColumn){ |
|
|
|
|
this.resolution = ((GridColumn)gHeader).getResolution(); |
|
|
|
|
}else { |
|
|
|
|
this.resolution = ((GridRow)gHeader).getResolution(); |
|
|
|
|
if (gHeader instanceof GridColumn) { |
|
|
|
|
this.resolution = ((GridColumn) gHeader).getResolution(); |
|
|
|
|
} else { |
|
|
|
|
this.resolution = ((GridRow) gHeader).getResolution(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -113,7 +115,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
if (between(evt, tmpSize1, tmpSize2)) { |
|
|
|
|
if (index >= dragIndex) { |
|
|
|
|
try { |
|
|
|
|
if(method != null) { |
|
|
|
|
if (method != null) { |
|
|
|
|
method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution)); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -122,7 +124,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
//sizeList.set(dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution));
|
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
if(method != null) { |
|
|
|
|
if (method != null) { |
|
|
|
|
method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution)); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -132,7 +134,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
// from all to do.
|
|
|
|
|
for (int h = (dragIndex - 1); h > index; h--) { |
|
|
|
|
try { |
|
|
|
|
if(method != null) { |
|
|
|
|
if (method != null) { |
|
|
|
|
method.invoke(report, h, UNIT.ZERO); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -223,7 +225,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
ePane.getGrid().stopEditing();// james 停止当前的所有编辑
|
|
|
|
|
|
|
|
|
|
// 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); |
|
|
|
|
|
|
|
|
@ -231,7 +233,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
if (SwingUtilities.isRightMouseButton(evt)) { |
|
|
|
|
Selection cs = ePane.getSelection(); |
|
|
|
|
resetSelectionByRightButton(selectedCellPoint, cs, ePane); |
|
|
|
|
|
|
|
|
|
checkEndMultiSelectIndex(cs); |
|
|
|
|
UIPopupMenu popupMenu = createPopupMenu(ePane, evt, Math.max(dragIndex, Math.max(this.startMultiSelectIndex, this.endMultiSelectIndex))); |
|
|
|
|
if (popupMenu != null) { |
|
|
|
|
GUICoreUtils.showPopupMenu(popupMenu, gHeader, evt.getX() + 1, evt.getY() + 1); |
|
|
|
@ -250,6 +252,18 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -310,8 +324,8 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
|
|
|
|
|
sb.append(String.format("%.2f", new Double(len))) |
|
|
|
|
.append('/').append(String.format("%.2f", new Double(tlen))) |
|
|
|
|
.append(unit).append('(') |
|
|
|
|
.append((int)(unitValue.toPixD(resolution))).append('/') |
|
|
|
|
.append((int)(totalUnitValue.toPixD(resolution))) |
|
|
|
|
.append((int) (unitValue.toPixD(resolution))).append('/') |
|
|
|
|
.append((int) (totalUnitValue.toPixD(resolution))) |
|
|
|
|
.append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px")) |
|
|
|
|
.append(')'); |
|
|
|
|
return sb.toString(); |
|
|
|
|