|
|
@ -4,8 +4,7 @@ |
|
|
|
package com.fr.poly; |
|
|
|
package com.fr.poly; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.*; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
@ -98,18 +97,22 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase |
|
|
|
private transient ArrayList<TemplateBlock> clip_board = new ArrayList<TemplateBlock>(); |
|
|
|
private transient ArrayList<TemplateBlock> clip_board = new ArrayList<TemplateBlock>(); |
|
|
|
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
|
|
|
|
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
|
|
|
|
private static final int ROTATIONS = 50; |
|
|
|
private static final int ROTATIONS = 50; |
|
|
|
|
|
|
|
private static final int MIN = 10; |
|
|
|
private JScrollBar verScrollBar; |
|
|
|
private JScrollBar verScrollBar; |
|
|
|
private JScrollBar horScrollBar; |
|
|
|
private JScrollBar horScrollBar; |
|
|
|
|
|
|
|
|
|
|
|
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar(); |
|
|
|
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar(); |
|
|
|
private JComponent[] toolBarComponent = null; |
|
|
|
private JComponent[] toolBarComponent = null; |
|
|
|
|
|
|
|
private JPanel ployareaPane; |
|
|
|
|
|
|
|
private JSliderPane jSliderContainer; |
|
|
|
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); |
|
|
|
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); |
|
|
|
private float time; |
|
|
|
private float time; |
|
|
|
|
|
|
|
private boolean isCtrl = false; |
|
|
|
|
|
|
|
|
|
|
|
public PolyDesigner(PolyWorkSheet report) { |
|
|
|
public PolyDesigner(PolyWorkSheet report) { |
|
|
|
super(report); |
|
|
|
super(report); |
|
|
|
setDoubleBuffered(true); |
|
|
|
setDoubleBuffered(true); |
|
|
|
|
|
|
|
|
|
|
|
// 为了处理键盘事件,需要FormDesigner能够获取焦点
|
|
|
|
// 为了处理键盘事件,需要FormDesigner能够获取焦点
|
|
|
|
setFocusable(true); |
|
|
|
setFocusable(true); |
|
|
|
setFocusTraversalKeysEnabled(false); |
|
|
|
setFocusTraversalKeysEnabled(false); |
|
|
@ -119,11 +122,13 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase |
|
|
|
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); |
|
|
|
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); |
|
|
|
|
|
|
|
|
|
|
|
setOpaque(true); |
|
|
|
setOpaque(true); |
|
|
|
|
|
|
|
|
|
|
|
initComponents(); |
|
|
|
initComponents(); |
|
|
|
|
|
|
|
|
|
|
|
this.initDataListeners(); |
|
|
|
this.initDataListeners(); |
|
|
|
this.initPolyBlocks(); |
|
|
|
this.initPolyBlocks(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFocusTraversalKeysEnabled(false); |
|
|
|
this.setFocusTraversalKeysEnabled(false); |
|
|
|
new PolyDesignerDropTarget(this); |
|
|
|
new PolyDesignerDropTarget(this); |
|
|
|
toolBarComponent = new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), new DeleteBlockAction(this).createToolBarComponent()}; |
|
|
|
toolBarComponent = new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), new DeleteBlockAction(this).createToolBarComponent()}; |
|
|
@ -143,8 +148,9 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initComponents() { |
|
|
|
private void initComponents() { |
|
|
|
|
|
|
|
jSliderContainer = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).reportComposite.getjSliderContainer(); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
JPanel ployareaPane = new JPanel(new PolyDesignerLayout()); |
|
|
|
ployareaPane = new JPanel(new PolyDesignerLayout()); |
|
|
|
polyArea = new PolyArea(this, resolution); |
|
|
|
polyArea = new PolyArea(this, resolution); |
|
|
|
ployareaPane.add(PolyDesignerLayout.Center, polyArea); |
|
|
|
ployareaPane.add(PolyDesignerLayout.Center, polyArea); |
|
|
|
|
|
|
|
|
|
|
@ -157,8 +163,26 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase |
|
|
|
ployareaPane.add(PolyDesignerLayout.HRuler, new HorizontalRuler(this)); |
|
|
|
ployareaPane.add(PolyDesignerLayout.HRuler, new HorizontalRuler(this)); |
|
|
|
this.add(ployareaPane, BorderLayout.CENTER); |
|
|
|
this.add(ployareaPane, BorderLayout.CENTER); |
|
|
|
this.add(polyComponetsBar, BorderLayout.WEST); |
|
|
|
this.add(polyComponetsBar, BorderLayout.WEST); |
|
|
|
|
|
|
|
this.addKeyListener(showValSpinnerKeyListener); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KeyListener showValSpinnerKeyListener = new KeyListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void keyTyped(KeyEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
|
|
|
|
if( e.isControlDown()){ |
|
|
|
|
|
|
|
isCtrl = true ; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void keyReleased(KeyEvent e) { |
|
|
|
|
|
|
|
isCtrl = false ; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private void initPolyBlocks() { |
|
|
|
private void initPolyBlocks() { |
|
|
|
for (int i = 0, count = this.getTarget().getBlockCount(); i < count; i++) { |
|
|
|
for (int i = 0, count = this.getTarget().getBlockCount(); i < count; i++) { |
|
|
|
TemplateBlock block = (TemplateBlock) getTarget().getBlock(i); |
|
|
|
TemplateBlock block = (TemplateBlock) getTarget().getBlock(i); |
|
|
@ -219,6 +243,10 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JPanel getPloyAreaPane(){ |
|
|
|
|
|
|
|
return this.ployareaPane; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 增加组件 |
|
|
|
* 增加组件 |
|
|
|
* @param currentEditor 组件 |
|
|
|
* @param currentEditor 组件 |
|
|
@ -644,8 +672,14 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase |
|
|
|
int id = evt.getID(); |
|
|
|
int id = evt.getID(); |
|
|
|
switch (id) { |
|
|
|
switch (id) { |
|
|
|
case MouseEvent.MOUSE_WHEEL: { |
|
|
|
case MouseEvent.MOUSE_WHEEL: { |
|
|
|
|
|
|
|
if (isCtrl){ |
|
|
|
|
|
|
|
int dir = evt.getWheelRotation(); |
|
|
|
|
|
|
|
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); |
|
|
|
|
|
|
|
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); |
|
|
|
|
|
|
|
}else { |
|
|
|
int rotations = evt.getWheelRotation(); |
|
|
|
int rotations = evt.getWheelRotation(); |
|
|
|
this.getVerticalScrollBar().setValue(this.getVerticalScrollBar().getValue() + rotations * ROTATIONS); |
|
|
|
this.getVerticalScrollBar().setValue(this.getVerticalScrollBar().getValue() + rotations * ROTATIONS); |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|