Browse Source

REPORT-2897 9.0设计器修改

缩放条部分-增加键盘快捷键
master
MoMeak 7 years ago
parent
commit
4800935232
  1. 2
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  2. 35
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  3. 100
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  4. 149
      designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
  5. 97
      designer_base/src/com/fr/design/mainframe/JSliderPane.java
  6. 38
      designer_form/src/com/fr/design/mainframe/FormArea.java
  7. 71
      designer_form/src/com/fr/design/mainframe/JForm.java

2
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -242,6 +242,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
initFormatBrush(); initFormatBrush();
} }
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }

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

@ -1,8 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.ItemEvent; import java.awt.event.*;
import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -51,6 +50,8 @@ public class ReportComponentComposite extends JComponent {
private JSliderPane jSliderContainer; private JSliderPane jSliderContainer;
private boolean isCtrl = false;
/** /**
* Constructor with workbook.. * Constructor with workbook..
@ -67,7 +68,37 @@ public class ReportComponentComposite extends JComponent {
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
}
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if( e.getKeyText(e.getKeyCode()).toLowerCase().equals("ctrl")){
isCtrl = true ;
}
} }
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false ;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl){
int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
}
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() { ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override

100
designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -1,26 +1,27 @@
package com.fr.design.mainframe.form; package com.fr.design.mainframe.form;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
import com.fr.report.ReportHelper;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.*;
import java.awt.event.ItemListener;
/** /**
* 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab * 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab
@ -36,7 +37,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private FormTabPane sheetNameTab; private FormTabPane sheetNameTab;
private JPanel hbarContainer; private JPanel hbarContainer;
private JSliderPane jSliderContainer; private JSliderPane jSliderContainer;
private boolean isCtrl = false;
public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) { public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) {
this.jForm = jform; this.jForm = jform;
@ -47,9 +48,42 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
((JForm)this.jForm).getFormDesign().getArea().addMouseWheelListener(showValSpinnerMouseWheelListener);
((JForm)this.jForm).getFormDesign().getArea().addKeyListener(showValSpinnerKeyListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
elementCaseDesigner.addTargetModifiedListener(this); elementCaseDesigner.addTargetModifiedListener(this);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if( e.getKeyText(e.getKeyCode()).toLowerCase().equals("ctrl")){
isCtrl = true ;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false ;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl){
int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
}
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() { ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@ -57,8 +91,8 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
value = value > MAX ? MAX : value; value = value > MAX ? MAX : value;
value = value < MIN ? MIN : value; value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); setScale(resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); // HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
} }
}; };
@ -66,7 +100,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (jSliderContainer.getSelfAdaptButton().isSelected()){ if (jSliderContainer.getSelfAdaptButton().isSelected()){
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().selfAdaptUpdate(); int resolution = selfAdaptUpdate();
jSliderContainer.getShowVal().setValue(resolution*HUND/ScreenResolution.getScreenResolution()); jSliderContainer.getShowVal().setValue(resolution*HUND/ScreenResolution.getScreenResolution());
} }
} }
@ -74,6 +108,52 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private java.util.List<TargetModifiedListener> targetModifiedList = new java.util.ArrayList<TargetModifiedListener>(); private java.util.List<TargetModifiedListener> targetModifiedList = new java.util.ArrayList<TargetModifiedListener>();
private void setScale(int resolution){
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution);
//更新Grid
Grid grid = elementCasePane.getGrid();
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase());
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase());
grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
elementCasePane.getGrid().updateUI();
//更新Column和Row
((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
elementCasePane.getGridColumn().setResolution(resolution);
elementCasePane.getGridColumn().updateUI();
elementCasePane.getGridRow().setResolution(resolution);
elementCasePane.getGridRow().updateUI();
}
private int selfAdaptUpdate(){
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jForm.resolution == 0){
jForm.resolution = ScreenResolution.getScreenResolution();
}
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
return jForm.resolution;
}
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * elementCasePane.getGrid().getResolution());
}
/** /**
* 添加目标改变的监听 * 添加目标改变的监听
* @param targetModifiedListener 目标改变事件 * @param targetModifiedListener 目标改变事件

149
designer_base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -29,21 +29,19 @@ public class JFormSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int ONEEIGHT = 18; private static final int ONE_EIGHT = 18;
private static final int FONTSIZE = 14; private static final int FONT_SIZE = 14;
private static final int SPINNERWIDTH= 45; private static final int SPINNER_WIDTH= 45;
private static final int SPINNERHEIGHT = 20; private static final int SPINNER_HEIGHT = 20;
private static final int TWOFIVE = 25; private static final int HALF_HUNDRED = 50;
private static final int FOURTEN = 40;
private static final int HALFHUNDRED = 50;
private static final int HUNDRED = 100; private static final int HUNDRED = 100;
private static final int TWOHUNDRED = 200; private static final int TWO_HUNDRED = 200;
private static final int THREEHUNDRED = 300; private static final int THREE_HUNDRED = 300;
private static final int FOURHUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOGWIDTH = 150; private static final int DIALOG_WIDTH = 150;
private static final int DIALOGHEIGHT = 220; private static final int DIALOG_HEIGHT = 240;
private static final int SHOWVALBUTTONWIDTH = 70; private static final int SHOWVALBUTTON_WIDTH = 70;
private static final int SHOWVALBUTTONHEIGHTH = 25; private static final int SHOWVALBUTTON_HEIGHTH = 25;
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JFormSliderPane THIS; private static JFormSliderPane THIS;
@ -71,14 +69,14 @@ public class JFormSliderPane extends JPanel {
public JFormSliderPane() { public JFormSliderPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
slider = new UISlider(0,HUNDRED,HALFHUNDRED); slider = new UISlider(0,HUNDRED,HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider)); slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener); slider.addChangeListener(listener);
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOURHUNDRED, 1)); showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
showValSpinner.setEnabled(true); showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener); showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNERWIDTH, SPINNERHEIGHT)); showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
//MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧 //MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0"); // JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
// showValSpinner.setEditor(editor); // showValSpinner.setEditor(editor);
@ -96,7 +94,7 @@ public class JFormSliderPane extends JPanel {
showValButton = new UIButton(showValSpinner.getValue()+"%"); showValButton = new UIButton(showValSpinner.getValue()+"%");
showValButton.setBorderPainted(false); showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTONWIDTH,SHOWVALBUTTONHEIGHTH)); showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH,SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener); showValButton.addActionListener(showValButtonActionListener);
initUIRadioButton(); initUIRadioButton();
@ -107,7 +105,7 @@ public class JFormSliderPane extends JPanel {
panel.add(upButton); panel.add(upButton);
panel.add(showValButton); panel.add(showValButton);
this.add(panel,BorderLayout.NORTH); this.add(panel,BorderLayout.NORTH);
this.setBounds(0,0,THREEHUNDRED,ONEEIGHT); this.setBounds(0,0,THREE_HUNDRED,ONE_EIGHT);
} }
public static final JFormSliderPane getInstance() { public static final JFormSliderPane getInstance() {
@ -166,7 +164,7 @@ public class JFormSliderPane extends JPanel {
JPanel spinnerPanel = new JPanel(new FlowLayout()); JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner); spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%"); UILabel percent = new UILabel("%");
percent.setFont(new Font("Dialog", Font.PLAIN, FONTSIZE)); percent.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
spinnerPanel.add(percent); spinnerPanel.add(percent);
return spinnerPanel; return spinnerPanel;
} }
@ -184,6 +182,14 @@ public class JFormSliderPane extends JPanel {
int val = (int) ((UIBasicSpinner)e.getSource()).getValue(); int val = (int) ((UIBasicSpinner)e.getSource()).getValue();
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
resolutionTimes = divide(showValue,100,2); resolutionTimes = divide(showValue,100,2);
if (val > FOUR_HUNDRED){
showValSpinner.setValue(FOUR_HUNDRED);
val = FOUR_HUNDRED;
}
if (val < TEN){
showValSpinner.setValue(TEN);
val = TEN;
}
refreshSlider(val); refreshSlider(val);
refreshBottun(val); refreshBottun(val);
} }
@ -224,11 +230,11 @@ public class JFormSliderPane extends JPanel {
private void refreshSlider(int val){ private void refreshSlider(int val){
showValue = val; showValue = val;
if (showValue >HUNDRED){ if (showValue >HUNDRED){
slider.setValue((int)(showValue+TWOHUNDRED)/SIX); slider.setValue((int)(showValue+TWO_HUNDRED)/SIX);
}else if (showValue <HUNDRED){ }else if (showValue <HUNDRED){
slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT)); slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT));
}else if (showValue == HUNDRED){ }else if (showValue == HUNDRED){
slider.setValue(HALFHUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -268,12 +274,12 @@ public class JFormSliderPane extends JPanel {
} }
if(e.getActionCommand().equals("more")){ if(e.getActionCommand().equals("more")){
int newUpVal = showValue + TEN; int newUpVal = showValue + TEN;
if (newUpVal <= FOURHUNDRED ){ if (newUpVal <= FOUR_HUNDRED ){
showValue = newUpVal; showValue = newUpVal;
showValSpinner.setValue(newUpVal); showValSpinner.setValue(newUpVal);
}else { }else {
showValue = newUpVal; showValue = newUpVal;
showValSpinner.setValue(FOURHUNDRED); showValSpinner.setValue(FOUR_HUNDRED);
} }
} }
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
@ -284,12 +290,12 @@ public class JFormSliderPane extends JPanel {
private void getTimes(int value){ private void getTimes(int value){
if (value == HALFHUNDRED){ if (value == HALF_HUNDRED){
times=HUNDRED; times=HUNDRED;
}else if (value < HALFHUNDRED){ }else if (value < HALF_HUNDRED){
times = (int) Math.round(ONEPOINTEIGHT*value + TEN); times = (int) Math.round(ONEPOINTEIGHT*value + TEN);
}else { }else {
times = (int) (SIX*value - TWOHUNDRED); times = (int) (SIX*value - TWO_HUNDRED);
} }
} }
@ -308,14 +314,14 @@ public class JFormSliderPane extends JPanel {
dialog = new FormPopupPane(upButton,dialogContentPanel); dialog = new FormPopupPane(upButton,dialogContentPanel);
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() + SHOWVALBUTTONWIDTH , -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH , -DIALOG_HEIGHT);
} }
}else { }else {
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOG_WIDTH + upButton.getWidth() +SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} else { } else {
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOG_WIDTH + upButton.getWidth() +SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} }
} }
} }
@ -334,82 +340,13 @@ public class JFormSliderPane extends JPanel {
} }
} }
//class JFromSliderPaneUI extends BasicSliderUI {
//
// private static final int VERTICAL_WIDTH = 11;
// private static final int VERTICAL_HEIGHT = 16;
// private static final int FOUR = 4;
// private static final int FIVE = 5;
// private static final int SIX = 6;
//
// public JFromSliderPaneUI(UISlider b) {
// super(b);
// }
//
// /** */
// /**
// * 绘制指示物
// */
//
// public Dimension getThumbSize() {
// Dimension size = new Dimension();
//
// if ( slider.getOrientation() == JSlider.VERTICAL ) {
// size.width = VERTICAL_WIDTH;
// size.height = VERTICAL_HEIGHT;
// }
// else {
// size.width = VERTICAL_WIDTH;
// size.height = VERTICAL_HEIGHT;
// }
//
// return size;
// }
//
// public void paintThumb(Graphics g) {
// Rectangle knobBounds = thumbRect;
// int w = knobBounds.width;
// int h = knobBounds.height;
//
// g.translate(knobBounds.x, knobBounds.y);
// if ( slider.isEnabled() ) {
// g.setColor(slider.getBackground());
// }
// else {
// g.setColor(slider.getBackground().darker());
// }
// g.setColor(Color.darkGray);
// g.fillRect(0, 1, w-SIX, h+1);
// }
//
// /** */
// /**
// * 绘制刻度轨迹
// */
// public void paintTrack(Graphics g) {
// int cy, cw;
// Rectangle trackBounds = trackRect;
// if (slider.getOrientation() == UISlider.HORIZONTAL) {
// Graphics2D g2 = (Graphics2D) g;
// cy = (trackBounds.height / 2);
// cw = trackBounds.width;
// g.setColor(Color.lightGray);
// g.drawLine(0, cy, cw+FIVE, cy);
// g.drawLine(FIVE+cw/2, cy-FOUR, FIVE+cw/2, cy+FOUR);
// } else {
// super.paintTrack(g);
// }
// }
//
//}
//
class FormPopupPane extends JPopupMenu { class FormPopupPane extends JPopupMenu {
private JComponent contentPane; private JComponent contentPane;
private static final int UPLABELHEIGHT = 25; private static final int UPLABEL_HEIGHT = 25;
private static final int HALFHUNDRED = 50; private static final int DIALOG_WIDTH = 150;
private static final int DIALOGWIDTH = 150; private static final int DIALOG_HEIGHT = 220;
private static final int DIALOGHEIGHT = 220; private static final int UPLABEL_WIDTH = 300;
private static final int UPLABELWIDTH = 300;
private JComponent centerPane; private JComponent centerPane;
private UILabel upLabel; private UILabel upLabel;
FormPopupPane(UIButton b,JPanel dialogContentPanel) { FormPopupPane(UIButton b,JPanel dialogContentPanel) {
@ -417,7 +354,7 @@ class FormPopupPane extends JPopupMenu {
centerPane = new JPanel(new BorderLayout()); centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true); upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT)); upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH,UPLABEL_HEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY); upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
centerPane.add(dialogContentPanel,BorderLayout.NORTH); centerPane.add(dialogContentPanel,BorderLayout.NORTH);
@ -425,7 +362,7 @@ class FormPopupPane extends JPopupMenu {
contentPane.add(centerPane,BorderLayout.CENTER); contentPane.add(centerPane,BorderLayout.CENTER);
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray)); // contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOGWIDTH, DIALOGHEIGHT)); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setOpaque(false); this.setOpaque(false);
} }

97
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -30,21 +29,19 @@ public class JSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int ONEEIGHT = 18; private static final int ONE_EIGHT = 18;
private static final int FONTSIZE = 14; private static final int FONT_SIZE = 14;
private static final int SPINNERWIDTH= 45; private static final int SPINNER_WIDTH= 45;
private static final int SPINNERHEIGHT = 20; private static final int SPINNER_HEIGHT = 20;
private static final int TWOFIVE = 25; private static final int HALF_HUNDRED = 50;
private static final int FOURTEN = 40;
private static final int HALFHUNDRED = 50;
private static final int HUNDRED = 100; private static final int HUNDRED = 100;
private static final int TWOHUNDRED = 200; private static final int TWO_HUNDRED = 200;
private static final int THREEHUNDRED = 300; private static final int THREE_HUNDRED = 300;
private static final int FOURHUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOGWIDTH = 150; private static final int DIALOG_WIDTH = 150;
private static final int DIALOGHEIGHT = 240; private static final int DIALOG_HEIGHT = 240;
private static final int SHOWVALBUTTONWIDTH = 70; private static final int SHOWVALBUTTON_WIDTH = 70;
private static final int SHOWVALBUTTONHEIGHTH = 25; private static final int SHOWVALBUTTON_HEIGHTH = 25;
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JSliderPane THIS; private static JSliderPane THIS;
@ -72,14 +69,14 @@ public class JSliderPane extends JPanel {
public JSliderPane() { public JSliderPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
slider = new UISlider(0,HUNDRED,HALFHUNDRED); slider = new UISlider(0,HUNDRED,HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider)); slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener); slider.addChangeListener(listener);
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOURHUNDRED, 1)); showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
showValSpinner.setEnabled(true); showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener); showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNERWIDTH, SPINNERHEIGHT)); showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
//MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧 //MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0"); // JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
// showValSpinner.setEditor(editor); // showValSpinner.setEditor(editor);
@ -97,9 +94,8 @@ public class JSliderPane extends JPanel {
showValButton = new UIButton(showValSpinner.getValue()+"%"); showValButton = new UIButton(showValSpinner.getValue()+"%");
showValButton.setBorderPainted(false); showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTONWIDTH,SHOWVALBUTTONHEIGHTH)); showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH,SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener); showValButton.addActionListener(showValButtonActionListener);
initUIRadioButton(); initUIRadioButton();
initPane(); initPane();
JPanel panel = new JPanel(new FlowLayout(1,1,0)); JPanel panel = new JPanel(new FlowLayout(1,1,0));
@ -108,7 +104,7 @@ public class JSliderPane extends JPanel {
panel.add(upButton); panel.add(upButton);
panel.add(showValButton); panel.add(showValButton);
this.add(panel,BorderLayout.NORTH); this.add(panel,BorderLayout.NORTH);
this.setBounds(0,0,THREEHUNDRED,ONEEIGHT); this.setBounds(0,0,THREE_HUNDRED,ONE_EIGHT);
} }
public static final JSliderPane getInstance() { public static final JSliderPane getInstance() {
@ -167,7 +163,7 @@ public class JSliderPane extends JPanel {
JPanel spinnerPanel = new JPanel(new FlowLayout()); JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner); spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%"); UILabel percent = new UILabel("%");
percent.setFont(new Font("Dialog", Font.PLAIN, FONTSIZE)); percent.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
spinnerPanel.add(percent); spinnerPanel.add(percent);
return spinnerPanel; return spinnerPanel;
} }
@ -185,6 +181,14 @@ public class JSliderPane extends JPanel {
int val = (int) ((UIBasicSpinner)e.getSource()).getValue(); int val = (int) ((UIBasicSpinner)e.getSource()).getValue();
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
resolutionTimes = divide(showValue,100,2); resolutionTimes = divide(showValue,100,2);
if (val > FOUR_HUNDRED){
showValSpinner.setValue(FOUR_HUNDRED);
val = FOUR_HUNDRED;
}
if (val < TEN){
showValSpinner.setValue(TEN);
val = TEN;
}
refreshSlider(val); refreshSlider(val);
refreshBottun(val); refreshBottun(val);
} }
@ -225,11 +229,11 @@ public class JSliderPane extends JPanel {
private void refreshSlider(int val){ private void refreshSlider(int val){
showValue = val; showValue = val;
if (showValue >HUNDRED){ if (showValue >HUNDRED){
slider.setValue((int)(showValue+TWOHUNDRED)/SIX); slider.setValue((int)(showValue+TWO_HUNDRED)/SIX);
}else if (showValue <HUNDRED){ }else if (showValue <HUNDRED){
slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT)); slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT));
}else if (showValue == HUNDRED){ }else if (showValue == HUNDRED){
slider.setValue(HALFHUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -269,12 +273,12 @@ public class JSliderPane extends JPanel {
} }
if(e.getActionCommand().equals("more")){ if(e.getActionCommand().equals("more")){
int newUpVal = showValue + TEN; int newUpVal = showValue + TEN;
if (newUpVal <= FOURHUNDRED ){ if (newUpVal <= FOUR_HUNDRED ){
showValue = newUpVal; showValue = newUpVal;
showValSpinner.setValue(newUpVal); showValSpinner.setValue(newUpVal);
}else { }else {
showValue = newUpVal; showValue = newUpVal;
showValSpinner.setValue(FOURHUNDRED); showValSpinner.setValue(FOUR_HUNDRED);
} }
} }
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
@ -285,12 +289,12 @@ public class JSliderPane extends JPanel {
private void getTimes(int value){ private void getTimes(int value){
if (value == HALFHUNDRED){ if (value == HALF_HUNDRED){
times=HUNDRED; times=HUNDRED;
}else if (value < HALFHUNDRED){ }else if (value < HALF_HUNDRED){
times = (int) Math.round(ONEPOINTEIGHT*value + TEN); times = (int) Math.round(ONEPOINTEIGHT*value + TEN);
}else { }else {
times = (int) (SIX*value - TWOHUNDRED); times = (int) (SIX*value - TWO_HUNDRED);
} }
} }
@ -309,28 +313,28 @@ public class JSliderPane extends JPanel {
dialog = new PopupPane(upButton,dialogContentPanel); dialog = new PopupPane(upButton,dialogContentPanel);
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() + SHOWVALBUTTONWIDTH , -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH , -DIALOG_HEIGHT);
} }
}else { }else {
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOG_WIDTH + upButton.getWidth() +SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} else { } else {
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOG_WIDTH + upButton.getWidth() +SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} }
} }
} }
public static void main(String[] args) public static void main(String[] args)
{ {
// JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel)jf.getContentPane(); JPanel content = (JPanel)jf.getContentPane();
// content.setLayout(new BorderLayout()); content.setLayout(new BorderLayout());
// content.add(JSliderPane.getInstance(),BorderLayout.CENTER); content.add(JSliderPane.getInstance(),BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf); GUICoreUtils.centerWindow(jf);
// jf.setSize(400, 80); jf.setSize(400, 80);
// jf.setVisible(true); jf.setVisible(true);
} }
} }
@ -406,11 +410,10 @@ class JSliderPaneUI extends BasicSliderUI {
class PopupPane extends JPopupMenu { class PopupPane extends JPopupMenu {
private JComponent contentPane; private JComponent contentPane;
private static final int UPLABELHEIGHT = 25; private static final int UPLABEL_HEIGHT = 25;
private static final int HALFHUNDRED = 50; private static final int DIALOG_WIDTH = 150;
private static final int DIALOGWIDTH = 150; private static final int DIALOG_HEIGHT = 240;
private static final int DIALOGHEIGHT = 240; private static final int UPLABEL_WIDTH = 300;
private static final int UPLABELWIDTH = 300;
private JComponent centerPane; private JComponent centerPane;
private UILabel upLabel; private UILabel upLabel;
PopupPane(UIButton b,JPanel dialogContentPanel) { PopupPane(UIButton b,JPanel dialogContentPanel) {
@ -418,7 +421,7 @@ class PopupPane extends JPopupMenu {
centerPane = new JPanel(new BorderLayout()); centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true); upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT)); upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH,UPLABEL_HEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY); upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
centerPane.add(dialogContentPanel,BorderLayout.NORTH); centerPane.add(dialogContentPanel,BorderLayout.NORTH);
@ -426,7 +429,7 @@ class PopupPane extends JPopupMenu {
contentPane.add(centerPane,BorderLayout.CENTER); contentPane.add(centerPane,BorderLayout.CENTER);
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray)); // contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOGWIDTH, DIALOGHEIGHT)); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setOpaque(false); this.setOpaque(false);
} }

38
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -9,11 +9,7 @@ import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -71,6 +67,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private double START_VALUE = DEFAULT_SLIDER; private double START_VALUE = DEFAULT_SLIDER;
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
private double screenValue; private double screenValue;
private boolean isCtrl = false;
public FormScrollBar getHorScrollBar() { public FormScrollBar getHorScrollBar() {
return horScrollBar; return horScrollBar;
@ -105,8 +102,39 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
addFormRuler(); addFormRuler();
} }
this.setFocusTraversalKeysEnabled(false); this.setFocusTraversalKeysEnabled(false);
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
this.designer.addKeyListener(showValSpinnerKeyListener);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if( e.getKeyText(e.getKeyCode()).toLowerCase().equals("ctrl")){
isCtrl = true ;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false ;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl){
int dir = e.getWheelRotation();
int old_resolution = (int) slidePane.getShowVal().getValue();
slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN));
}
}
};
/** /**
* 增加表单的页面大小控制界面包括手动修改和滑块拖动 * 增加表单的页面大小控制界面包括手动修改和滑块拖动
*/ */

71
designer_form/src/com/fr/design/mainframe/JForm.java

@ -1,13 +1,10 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.cell.FloatElementsProvider; import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction; import com.fr.design.designer.beans.actions.CutAction;
@ -29,8 +26,6 @@ import com.fr.design.mainframe.actions.FormMobileAttrAction;
import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.actions.TemplateParameterAction;
import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.form.FormElementCasePaneDelegate;
import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.templateinfo.JFormProcessInfo; import com.fr.design.mainframe.templateinfo.JFormProcessInfo;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -52,9 +47,6 @@ import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
import com.fr.report.ReportHelper;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -112,6 +104,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return processInfo; return processInfo;
} }
public FormECCompositeProvider getReportComposite(){
return this.reportComposite;
}
@Override @Override
public void setJTemplateResolution(int resolution) { public void setJTemplateResolution(int resolution) {
@ -264,25 +260,25 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
public void setScale(int resolution) { public void setScale(int resolution) {
this.resolution = resolution; // this.resolution = resolution;
ElementCasePane elementCasePane = ((FormReportComponentComposite)reportComposite).elementCaseDesigner.getEditingElementCasePane(); // ElementCasePane elementCasePane = ((FormReportComponentComposite)reportComposite).elementCaseDesigner.getEditingElementCasePane();
elementCasePane.setResolution(resolution); // elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); // elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution); // elementCasePane.getGrid().setResolution(resolution);
//更新Grid // //更新Grid
Grid grid = elementCasePane.getGrid(); // Grid grid = elementCasePane.getGrid();
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase()); // DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase());
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase()); // DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase());
grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution)); // grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution)); // grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
elementCasePane.getGrid().updateUI(); // elementCasePane.getGrid().updateUI();
//更新Column和Row // //更新Column和Row
((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution); // ((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution); // ((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
elementCasePane.getGridColumn().setResolution(resolution); // elementCasePane.getGridColumn().setResolution(resolution);
elementCasePane.getGridColumn().updateUI(); // elementCasePane.getGridColumn().updateUI();
elementCasePane.getGridRow().setResolution(resolution); // elementCasePane.getGridRow().setResolution(resolution);
elementCasePane.getGridRow().updateUI(); // elementCasePane.getGridRow().updateUI();
} }
@Override @Override
@ -292,26 +288,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
public int selfAdaptUpdate() { public int selfAdaptUpdate() {
if (resolution == 0){ return 0;
resolution = ScreenResolution.getScreenResolution();
}
ElementCasePane elementCasePane = ((FormReportComponentComposite)reportComposite).elementCaseDesigner.getEditingElementCasePane();
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
return resolution;
}
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * elementCasePane.getGrid().getResolution());
} }
/** /**

Loading…
Cancel
Save