Browse Source

REPORT-2897 9.0设计器修改

聚合报表缩放条快捷键
master
MoMeak 8 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. 46
      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 UIModeControlContainer centerPane;
private ReportComponentComposite reportComposite;
public ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane;
private int resolution;
@ -394,7 +394,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return resolution;
}
double time =(areaHeight/creatorHeight)<(areaWidth/creatorWidth) ? (areaHeight/creatorHeight) : (areaWidth/creatorWidth);
return (int) (time * polyDezi.getResolution());
return (int) (time * ScreenResolution.getScreenResolution());
}else if (elementCasePane != null) {
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.grid.Grid;
import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyArea;
import com.fr.report.report.TemplateReport;
/**
@ -58,6 +59,8 @@ public class ReportComponentComposite extends JComponent {
*
*/
public ReportComponentComposite(JWorkBook jwb) {
setFocusable(true);
setFocusTraversalKeysEnabled(false);
this.parent = jwb;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(centerCardPane = new ReportComponentCardPane(), BorderLayout.CENTER);
@ -135,6 +138,7 @@ public class ReportComponentComposite extends JComponent {
return;
}
centerCardPane.populate(workbook.getTemplateReport(newIndex));
if (parentContainer != null) {
parentContainer.setDownPane(ReportComponentComposite.this);
}
@ -184,6 +188,10 @@ public class ReportComponentComposite extends JComponent {
return sheetNameTab.getSelectedIndex();
}
public JSliderPane getjSliderContainer(){
return this.jSliderContainer;
}
public void setParentContainer(UIModeControlContainer parentContainer) {
this.parentContainer = parentContainer;
@ -237,16 +245,6 @@ public class ReportComponentComposite extends JComponent {
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) {
sheetNameTab.setSelectedIndex(selectedIndex);

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

@ -4,8 +4,7 @@
package com.fr.poly;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
@ -98,18 +97,22 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private transient ArrayList<TemplateBlock> clip_board = new ArrayList<TemplateBlock>();
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
private static final int ROTATIONS = 50;
private static final int MIN = 10;
private JScrollBar verScrollBar;
private JScrollBar horScrollBar;
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar();
private JComponent[] toolBarComponent = null;
private JPanel ployareaPane;
private JSliderPane jSliderContainer;
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
private float time;
private boolean isCtrl = false;
public PolyDesigner(PolyWorkSheet report) {
super(report);
setDoubleBuffered(true);
// 为了处理键盘事件,需要FormDesigner能够获取焦点
setFocusable(true);
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);
setOpaque(true);
initComponents();
this.initDataListeners();
this.initPolyBlocks();
this.setFocusTraversalKeysEnabled(false);
new PolyDesignerDropTarget(this);
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() {
jSliderContainer = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).reportComposite.getjSliderContainer();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel ployareaPane = new JPanel(new PolyDesignerLayout());
ployareaPane = new JPanel(new PolyDesignerLayout());
polyArea = new PolyArea(this, resolution);
ployareaPane.add(PolyDesignerLayout.Center, polyArea);
@ -157,8 +163,26 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
ployareaPane.add(PolyDesignerLayout.HRuler, new HorizontalRuler(this));
this.add(ployareaPane, BorderLayout.CENTER);
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() {
for (int i = 0, count = this.getTarget().getBlockCount(); i < count; 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 组件
@ -644,8 +672,14 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
int id = evt.getID();
switch (id) {
case MouseEvent.MOUSE_WHEEL: {
int rotations = evt.getWheelRotation();
this.getVerticalScrollBar().setValue(this.getVerticalScrollBar().getValue() + rotations * ROTATIONS);
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();
this.getVerticalScrollBar().setValue(this.getVerticalScrollBar().getValue() + rotations * ROTATIONS);
}
break;
}
}

Loading…
Cancel
Save