|
|
@ -30,20 +30,20 @@ import com.fr.stable.unit.UnitRectangle; |
|
|
|
* @since 6.5.4 创建于2011-5-5 聚合报表块编辑器 |
|
|
|
* @since 6.5.4 创建于2011-5-5 聚合报表块编辑器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> extends JComponent{ |
|
|
|
public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> extends JComponent{ |
|
|
|
|
|
|
|
|
|
|
|
protected PolyDesigner designer; |
|
|
|
protected PolyDesigner designer; |
|
|
|
protected BlockCreator<U> creator; |
|
|
|
protected BlockCreator<U> creator; |
|
|
|
protected int resolution = ScreenResolution.getScreenResolution(); |
|
|
|
protected int resolution = ScreenResolution.getScreenResolution(); |
|
|
|
protected T editComponent; |
|
|
|
protected T editComponent; |
|
|
|
|
|
|
|
|
|
|
|
private JComponent addHeightTool;// 改变高度的组件
|
|
|
|
private JComponent addHeightTool;// 改变高度的组件
|
|
|
|
private JComponent addWidthTool; // 改变宽度的组件
|
|
|
|
private JComponent addWidthTool; // 改变宽度的组件
|
|
|
|
private JComponent moveTool; // 拖动聚合块的组件
|
|
|
|
private JComponent moveTool; // 拖动聚合块的组件
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isDragging; |
|
|
|
private boolean isDragging; |
|
|
|
private Absorptionline lineInX; |
|
|
|
private Absorptionline lineInX; |
|
|
|
private Absorptionline lineInY; |
|
|
|
private Absorptionline lineInY; |
|
|
|
|
|
|
|
|
|
|
|
private BlockForbiddenWindow forbiddenWindow; |
|
|
|
private BlockForbiddenWindow forbiddenWindow; |
|
|
|
|
|
|
|
|
|
|
|
public BlockEditor(PolyDesigner designer, BlockCreator<U> creator) { |
|
|
|
public BlockEditor(PolyDesigner designer, BlockCreator<U> creator) { |
|
|
@ -74,16 +74,16 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> |
|
|
|
|
|
|
|
|
|
|
|
this.moveTool = new BlockControlButton(); |
|
|
|
this.moveTool = new BlockControlButton(); |
|
|
|
this.add(BlockEditorLayout.BOTTOMCORNER, this.moveTool); |
|
|
|
this.add(BlockEditorLayout.BOTTOMCORNER, this.moveTool); |
|
|
|
|
|
|
|
|
|
|
|
this.forbiddenWindow = new BlockForbiddenWindow(); |
|
|
|
this.forbiddenWindow = new BlockForbiddenWindow(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 重置当前鼠标选中状态 |
|
|
|
* 重置当前鼠标选中状态 |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract void resetSelectionAndChooseState(); |
|
|
|
public abstract void resetSelectionAndChooseState(); |
|
|
|
|
|
|
|
|
|
|
|
protected abstract T createEffective(); |
|
|
|
protected abstract T createEffective(); |
|
|
|
|
|
|
|
|
|
|
|
protected abstract Dimension getAddHeigthPreferredSize(); |
|
|
|
protected abstract Dimension getAddHeigthPreferredSize(); |
|
|
@ -91,9 +91,9 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> |
|
|
|
protected abstract Dimension getAddWidthPreferredSize(); |
|
|
|
protected abstract Dimension getAddWidthPreferredSize(); |
|
|
|
|
|
|
|
|
|
|
|
protected abstract void initDataChangeListener(); |
|
|
|
protected abstract void initDataChangeListener(); |
|
|
|
|
|
|
|
|
|
|
|
protected abstract RowOperationMouseHandler createRowOperationMouseHandler(); |
|
|
|
protected abstract RowOperationMouseHandler createRowOperationMouseHandler(); |
|
|
|
|
|
|
|
|
|
|
|
protected abstract ColumnOperationMouseHandler createColumnOperationMouseHandler(); |
|
|
|
protected abstract ColumnOperationMouseHandler createColumnOperationMouseHandler(); |
|
|
|
|
|
|
|
|
|
|
|
protected void addColumnRowListeners() { |
|
|
|
protected void addColumnRowListeners() { |
|
|
@ -122,28 +122,31 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> |
|
|
|
initSize(); |
|
|
|
initSize(); |
|
|
|
LayoutUtils.layoutRootContainer(BlockEditor.this); |
|
|
|
LayoutUtils.layoutRootContainer(BlockEditor.this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean equals(Object o) { |
|
|
|
public boolean equals(Object o) { |
|
|
|
|
|
|
|
if (o == null) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
return ComparatorUtils.equals(o.getClass().getName(), this.getClass().getName()); |
|
|
|
return ComparatorUtils.equals(o.getClass().getName(), this.getClass().getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setDragging(boolean isDragging) { |
|
|
|
public void setDragging(boolean isDragging) { |
|
|
|
this.isDragging = isDragging; |
|
|
|
this.isDragging = isDragging; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当前是否处于拖动状态 |
|
|
|
* 当前是否处于拖动状态 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 是否处于拖动状态 |
|
|
|
* @return 是否处于拖动状态 |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean isDragging() { |
|
|
|
public boolean isDragging() { |
|
|
|
return this.isDragging; |
|
|
|
return this.isDragging; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setXAbsorptionline(Absorptionline line) { |
|
|
|
public void setXAbsorptionline(Absorptionline line) { |
|
|
|
this.lineInX = line; |
|
|
|
this.lineInX = line; |
|
|
|
} |
|
|
|
} |
|
|
@ -151,27 +154,27 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> |
|
|
|
public void setYAbsorptionline(Absorptionline line) { |
|
|
|
public void setYAbsorptionline(Absorptionline line) { |
|
|
|
this.lineInY = line; |
|
|
|
this.lineInY = line; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 显示禁止重叠窗口 |
|
|
|
* 显示禁止重叠窗口 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param x x坐标 |
|
|
|
* @param x x坐标 |
|
|
|
* @param y y坐标 |
|
|
|
* @param y y坐标 |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void showForbiddenWindow(int x, int y){ |
|
|
|
public void showForbiddenWindow(int x, int y){ |
|
|
|
this.forbiddenWindow.showWindow(x, y); |
|
|
|
this.forbiddenWindow.showWindow(x, y); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 隐藏禁止重叠窗口 |
|
|
|
* 隐藏禁止重叠窗口 |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void hideForbiddenWindow(){ |
|
|
|
public void hideForbiddenWindow(){ |
|
|
|
this.forbiddenWindow.hideWindow(); |
|
|
|
this.forbiddenWindow.hideWindow(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void paintAbsorptionline(Graphics g) { |
|
|
|
public void paintAbsorptionline(Graphics g) { |
|
|
|
if(lineInX != null) { |
|
|
|
if(lineInX != null) { |
|
|
|
lineInX.paint(g,designer); |
|
|
|
lineInX.paint(g,designer); |
|
|
@ -202,7 +205,7 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> |
|
|
|
public Dimension getCornerSize() { |
|
|
|
public Dimension getCornerSize() { |
|
|
|
return new Dimension(); |
|
|
|
return new Dimension(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class BlockControlButton extends UIButton { |
|
|
|
private class BlockControlButton extends UIButton { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public ButtonUI getUI() { |
|
|
|
public ButtonUI getUI() { |
|
|
@ -220,4 +223,4 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock> |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|