Browse Source

REPORT-2897 9.0设计器修改

聚合报表缩放条快捷键
master
MoMeak 7 years ago
parent
commit
616c69a90c
  1. 4
      designer/src/com/fr/design/mainframe/JWorkBook.java
  2. 18
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  3. 42
      designer/src/com/fr/poly/PolyDesigner.java

4
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -86,7 +86,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private static final int TOOLBARPANEDIMHEIGHT = 26; private static final int TOOLBARPANEDIMHEIGHT = 26;
private UIModeControlContainer centerPane; private UIModeControlContainer centerPane;
private ReportComponentComposite reportComposite; public ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane; private ParameterDefinitePane parameterPane;
private int resolution; private int resolution;
@ -394,7 +394,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return resolution; return resolution;
} }
double time =(areaHeight/creatorHeight)<(areaWidth/creatorWidth) ? (areaHeight/creatorHeight) : (areaWidth/creatorWidth); double time =(areaHeight/creatorHeight)<(areaWidth/creatorWidth) ? (areaHeight/creatorHeight) : (areaWidth/creatorWidth);
return (int) (time * polyDezi.getResolution()); return (int) (time * ScreenResolution.getScreenResolution());
}else if (elementCasePane != null) { }else if (elementCasePane != null) {
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane(); ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();

18
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -23,6 +23,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyArea;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
/** /**
@ -58,6 +59,8 @@ public class ReportComponentComposite extends JComponent {
* *
*/ */
public ReportComponentComposite(JWorkBook jwb) { public ReportComponentComposite(JWorkBook jwb) {
setFocusable(true);
setFocusTraversalKeysEnabled(false);
this.parent = jwb; this.parent = jwb;
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(centerCardPane = new ReportComponentCardPane(), BorderLayout.CENTER); this.add(centerCardPane = new ReportComponentCardPane(), BorderLayout.CENTER);
@ -135,6 +138,7 @@ public class ReportComponentComposite extends JComponent {
return; return;
} }
centerCardPane.populate(workbook.getTemplateReport(newIndex)); centerCardPane.populate(workbook.getTemplateReport(newIndex));
if (parentContainer != null) { if (parentContainer != null) {
parentContainer.setDownPane(ReportComponentComposite.this); parentContainer.setDownPane(ReportComponentComposite.this);
} }
@ -184,6 +188,10 @@ public class ReportComponentComposite extends JComponent {
return sheetNameTab.getSelectedIndex(); return sheetNameTab.getSelectedIndex();
} }
public JSliderPane getjSliderContainer(){
return this.jSliderContainer;
}
public void setParentContainer(UIModeControlContainer parentContainer) { public void setParentContainer(UIModeControlContainer parentContainer) {
this.parentContainer = parentContainer; this.parentContainer = parentContainer;
@ -237,16 +245,6 @@ public class ReportComponentComposite extends JComponent {
return southPane; return southPane;
} }
private JComponent createSouthControlPaneWithJSliderPane() {
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar());
JSplitPane splitWithJSliderPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hbarContainer, JSliderPane.getInstance());
splitWithJSliderPane.setBorder(null);
splitWithJSliderPane.setDividerLocation(0.9);
splitWithJSliderPane.setDividerSize(3);
splitWithJSliderPane.setResizeWeight(1);
return splitWithJSliderPane;
}
public void setSelectedIndex(int selectedIndex) { public void setSelectedIndex(int selectedIndex) {
sheetNameTab.setSelectedIndex(selectedIndex); sheetNameTab.setSelectedIndex(selectedIndex);

42
designer/src/com/fr/poly/PolyDesigner.java

@ -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,7 +163,25 @@ 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++) {
@ -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;
} }
} }

Loading…
Cancel
Save