From 707810a4f84d64717b43fb3c1be17ebdf9fd3e7d Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 4 Aug 2020 20:09:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-31758=20=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E8=AE=BE=E8=AE=A1=E9=9D=A2=E6=9D=BF=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=BC=A9=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/JFormSliderPane.java | 128 +++-- .../com/fr/design/mainframe/JSliderPane.java | 516 ------------------ .../design/designer/creator/XElementCase.java | 8 + .../designer/creator/XNumberEditor.java | 8 +- .../design/designer/creator/XWFitLayout.java | 6 + .../creator/cardlayout/XCardAddButton.java | 41 +- .../creator/cardlayout/XWCardTagLayout.java | 10 +- .../fr/design/form/layout/FRFitLayout.java | 29 +- .../fr/design/form/layout/FRTitleLayout.java | 34 +- .../com/fr/design/mainframe/FormArea.java | 36 +- .../com/fr/design/mainframe/FormDesigner.java | 14 +- .../designer/component/WidgetBoundPane.java | 33 +- .../mainframe/ReportComponentComposite.java | 28 +- .../design/mainframe/WorkSheetDesigner.java | 6 +- .../form/FormReportComponentComposite.java | 27 +- .../src/main/java/com/fr/grid/GridColumn.java | 3 +- .../java/com/fr/grid/GridMouseAdapter.java | 5 +- .../src/main/java/com/fr/grid/GridUtils.java | 8 +- .../main/java/com/fr/poly/PolyDesigner.java | 11 +- 19 files changed, 270 insertions(+), 681 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java index 0658d6040..adea8d7e4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java @@ -2,24 +2,31 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; -import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.PlainDocument; +import javax.swing.plaf.basic.BasicSliderUI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; @@ -29,6 +36,7 @@ import java.math.BigDecimal; * Created by MoMeak on 2017/7/13. */ public class JFormSliderPane extends JPanel { + public static final Image APPFIT_V0 = BaseUtils.readImage("com/fr/design/images/control/icon_thumb_normal.png"); private static final double ONEPOINTEIGHT = 1.8; private static final int SIX = 6; @@ -37,14 +45,13 @@ public class JFormSliderPane extends JPanel { private static final int HUNDRED = 100; private static final int TWO_HUNDRED = 200; private static final int FOUR_HUNDRED = 400; - private static final int SHOWVALBUTTON_WIDTH = 40; + private static final int SHOWVALBUTTON_WIDTH = 35; private static final int SHOWVALBUTTON_HEIGHTH = 20; private static final String SUFFIX = "%"; - private static final String REGEX = "[\\d%]*"; private static final int TOOLTIP_Y = 30; private static final Color BACK_COLOR = new Color(245, 245, 247); public int showValue = 100; - private UITextField showValField; + private UINumberField showValField; private UISlider slider; private int times; private int sliderValue; @@ -64,6 +71,9 @@ public class JFormSliderPane extends JPanel { panel.add(slider); panel.add(upButton); panel.add(showValField); + UILabel uiLabel = new UILabel(SUFFIX); + uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + panel.add(uiLabel); panel.setBackground(BACK_COLOR); this.add(panel, BorderLayout.NORTH); } @@ -112,8 +122,8 @@ public class JFormSliderPane extends JPanel { } private void initShowValField() { - showValField = new UITextField(showValue + SUFFIX); - showValField.setBorderPainted(false); + showValField = new UINumberField(); + showValField.setValue(showValue); showValField.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValField.addKeyListener(new KeyListener() { @Override @@ -131,27 +141,28 @@ public class JFormSliderPane extends JPanel { int code = evt.getKeyCode(); if (code == KeyEvent.VK_ENTER) { - showValue = parseInputValue(showValField.getText()); - showValField.setText(showValue + SUFFIX); - showValFieldChange(); + showValFieldChange((int) showValField.getValue()); } } }); - showValField.setDocument(new PlainDocument() { + showValField.addFocusListener(new FocusListener() { @Override - public void insertString(int offset, String s, AttributeSet a) throws BadLocationException { - if (!s.matches(REGEX)) { - return; - } - super.insertString(offset, s, a); + public void focusGained(FocusEvent e) { + } - }); + @Override + public void focusLost(FocusEvent e) { + showValFieldChange((int) showValField.getValue()); + } + }); } - private void showValFieldChange() { + + + private void showValFieldChange(int value) { isButtonOrIsTxt = true; - showValue = getPreferredValue(showValue); + showValue = getPreferredValue(value); refreshShowValueFieldText(); refreshSlider(); } @@ -167,22 +178,10 @@ public class JFormSliderPane extends JPanel { } private void refreshShowValueFieldText(){ - showValField.setText(showValue + SUFFIX); - } - - private int parseInputValue(String text){ - if (text.endsWith(SUFFIX)){ - text = text.substring(0, text.length() -1); - } - try{ - return Integer.parseInt(text); - }catch (NumberFormatException e){ - return HUNDRED; - } + showValField.setValue(showValue); + setAdjustButtonStatus(); } - - //定义一个监听器,用于监听所有滑动条 private ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent event) { @@ -207,6 +206,11 @@ public class JFormSliderPane extends JPanel { slider.setValue(calSliderValue(showValue)); } + private void setAdjustButtonStatus(){ + this.downButton.setEnabled(this.showValue > TEN); + this.upButton.setEnabled(this.showValue < FOUR_HUNDRED); + } + private int calSliderValue(int value) { int result; if (value > HUNDRED) { @@ -245,7 +249,7 @@ public class JFormSliderPane extends JPanel { if (newUpVal <= FOUR_HUNDRED) { showValue = newUpVal; } else { - showValue = TEN; + showValue = FOUR_HUNDRED; } refreshShowValueFieldText(); refreshSlider(); @@ -271,8 +275,7 @@ public class JFormSliderPane extends JPanel { } public void setShowValue(int value) { - showValue = value; - showValFieldChange(); + showValFieldChange(value); } @@ -280,6 +283,55 @@ public class JFormSliderPane extends JPanel { this.slider.addChangeListener(changeListener); } + class JSliderPaneUI extends BasicSliderUI { + + private static final int THUMB_XOFFSET = 8; + private static final int THUMB_YOFFSET = 3; + private static final int FOUR = 4; + private static final int FIVE = 5; + private static final int SIX = 6; + private static final int MID_X_SHIFT = 2; // 中点标记的水平位置偏移 + + public JSliderPaneUI(UISlider b) { + super(b); + } + + /** + * 绘制指示物 + */ + public void paintThumb(Graphics g) { + Rectangle knobBounds = thumbRect; + Graphics2D g2d = (Graphics2D) g; + g2d.drawImage(APPFIT_V0, knobBounds.x - THUMB_XOFFSET, knobBounds.y + THUMB_YOFFSET, null); + g2d.dispose(); + } + + /** + * 绘制刻度轨迹 + */ + 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; + g2.setPaint(BACK_COLOR); + g2.fillRect(0, -cy, cw + 10, cy * 4); + g.setColor(new Color(216, 216, 216)); + g.drawLine(0, cy, cw + 3, cy); + g.drawLine(MID_X_SHIFT + cw / 2, cy - FOUR, MID_X_SHIFT + cw / 2, cy + FOUR); + } else { + super.paintTrack(g); + } + } + + public void setThumbLocation(int x, int y) { + super.setThumbLocation(x, y); + slider.repaint(); + } + + } public static void main(String[] args) { JFrame jf = new JFrame("test"); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java deleted file mode 100644 index 4c8f307d6..000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java +++ /dev/null @@ -1,516 +0,0 @@ -package com.fr.design.mainframe; - -import com.fr.base.BaseUtils; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.ibutton.UISliderButton; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.imenu.UIPopupMenu; -import com.fr.design.gui.islider.UISlider; -import com.fr.design.gui.ispinner.UIBasicSpinner; -import com.fr.design.gui.ispinner.UISpinnerUI; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; - - -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JFormattedTextField; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JSpinner; -import javax.swing.SpinnerNumberModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.plaf.basic.BasicSliderUI; -import javax.swing.text.DefaultFormatterFactory; -import javax.swing.text.NumberFormatter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.EventQueue; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseEvent; -import java.math.BigDecimal; - -/** - * Created by MoMeak on 2017/7/13. - */ -public class JSliderPane extends JPanel { - - public static final Image APPFIT_V0 = BaseUtils.readImage("com/fr/design/images/control/icon_thumb_normal.png"); - private static final double ONEPOINTEIGHT = 1.8; - private static final int SIX = 6; - private static final int TEN = 10; - private static final int FONT_SIZE = 12; - private static final int SPINNER_WIDTH = 45; - private static final int SPINNER_HEIGHT = 20; - private static final int HALF_HUNDRED = 50; - private static final int HUNDRED = 100; - private static final int TWO_HUNDRED = 200; - private static final int FOUR_HUNDRED = 400; - private static final int SHOWVALBUTTON_WIDTH = 40; - private static final int SHOWVALBUTTON_HEIGHTH = 20; - private static final int TOOLTIP_Y = 30; - - private static final Color BACK_COLOR = new Color(245, 245, 247); - public int showValue = 100; - public double resolutionTimes = 1.0; - private UITextField showVal; - private JSpinner showValSpinner; - private UISlider slider; - private int times; - private int sliderValue; - private UIButton downButton; - private UIButton upButton; - private UISliderButton showValButton; - private UIRadioButton twoHundredButton; - private UIRadioButton oneHundredButton; - private UIRadioButton sevenFiveButton; - private UIRadioButton fiveTenButton; - private UIRadioButton twoFiveButton; - private UIRadioButton selfAdaptButton; - private UIRadioButton customButton; - /** - * 拖动条处理和button、直接输入不一样 - */ - private boolean isButtonOrIsTxt = true; - private PopupPane dialog; - private int upButtonX; - private JPanel dialogContentPanel; - - - public JSliderPane() { - this.setLayout(new BorderLayout()); - initSlider(); - initShowValSpinner(); - //MoMeak:控制只能输入10-400 - JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0"); - showValSpinner.setEditor(editor); - JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); - textField.setEditable(true); - DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory(); - NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); - formatter.setAllowsInvalid(false); - - initDownUpButton(); - initShowValButton(); - initUIRadioButton(); - initPane(); - JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); - panel.add(downButton); - panel.add(slider); - panel.add(upButton); - panel.add(showValButton); - panel.setBackground(BACK_COLOR); - this.add(panel, BorderLayout.NORTH); - } - - - public static JSliderPane getInstance() { - return new JSliderPane(); - } - - private void initSlider() { - slider = new UISlider(0, HUNDRED, HALF_HUNDRED) { - public Point getToolTipLocation(MouseEvent event) { - return new Point(event.getX(), event.getY() - TOOLTIP_Y); - } - }; - slider.setUI(new JSliderPaneUI(slider)); - slider.addChangeListener(listener); - slider.setPreferredSize(new Dimension(220, 20)); - //去掉虚线框 - slider.setFocusable(false); - slider.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Slider")); - } - - private void initShowValSpinner() { - showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) { - public Point getToolTipLocation(MouseEvent event) { - return new Point(event.getX(), event.getY() - TOOLTIP_Y); - } - }; - showValSpinner.setUI(new UISpinnerUI()); - showValSpinner.setEnabled(true); - showValSpinner.addChangeListener(showValSpinnerChangeListener); - showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT)); - } - - private void initDownUpButton() { - downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) { - public Point getToolTipLocation(MouseEvent event) { - return new Point(event.getX(), event.getY() - TOOLTIP_Y); - } - }; - downButton.setOpaque(false); - downButton.setBorderPainted(false); - downButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Down")); - upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")) { - public Point getToolTipLocation(MouseEvent event) { - return new Point(event.getX(), event.getY() - TOOLTIP_Y); - } - }; - upButton.setOpaque(false); - upButton.setBorderPainted(false); - upButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Up")); - downButton.setActionCommand("less"); - upButton.setActionCommand("more"); - downButton.addActionListener(buttonActionListener); - upButton.addActionListener(buttonActionListener); - } - - private void initShowValButton() { - showValButton = new UISliderButton(showValSpinner.getValue() + "%"); - showValButton.setBackground(BACK_COLOR); - showValButton.setBorderPainted(false); - showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); - showValButton.addActionListener(showValButtonActionListener); - showValButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Grade")); - } - - private void initUIRadioButton() { - twoHundredButton = new UIRadioButton("200%"); - oneHundredButton = new UIRadioButton("100%"); - sevenFiveButton = new UIRadioButton("75%"); - fiveTenButton = new UIRadioButton("50%"); - twoFiveButton = new UIRadioButton("25%"); - selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button")); - selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); - customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button")); - customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); - twoHundredButton.addItemListener(radioButtonItemListener); - oneHundredButton.addItemListener(radioButtonItemListener); - sevenFiveButton.addItemListener(radioButtonItemListener); - fiveTenButton.addItemListener(radioButtonItemListener); - twoFiveButton.addItemListener(radioButtonItemListener); - customButton.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - JRadioButton temp = (JRadioButton) e.getSource(); - if (temp.isSelected()) { - JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); - textField.requestFocus(); - textField.selectAll(); - } - } - }); - - ButtonGroup bg = new ButtonGroup();// 初始化按钮组 - bg.add(twoHundredButton);// 加入按钮组 - bg.add(oneHundredButton); - bg.add(sevenFiveButton); - bg.add(fiveTenButton); - bg.add(twoFiveButton); - bg.add(selfAdaptButton); - bg.add(customButton); - customButton.setSelected(true); - } - - private void initPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p, p, p, p, p, p, p}; - UILabel upLabel = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_EnlargeOrReduce")); - upLabel.setOpaque(false); - JPanel septPane = new JPanel(new BorderLayout()); - JSeparator sept = new JSeparator(); - sept.setBackground(new Color(232, 232, 233)); - septPane.add(sept, BorderLayout.NORTH); - septPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 1, 10)); - septPane.setBackground(BACK_COLOR); - twoHundredButton.setBackground(BACK_COLOR); - oneHundredButton.setBackground(BACK_COLOR); - sevenFiveButton.setBackground(BACK_COLOR); - fiveTenButton.setBackground(BACK_COLOR); - twoFiveButton.setBackground(BACK_COLOR); - selfAdaptButton.setBackground(BACK_COLOR); - customButton.setBackground(BACK_COLOR); - Component[][] components = new Component[][]{ - new Component[]{upLabel, null}, - new Component[]{septPane, null}, - new Component[]{twoHundredButton, null}, - new Component[]{oneHundredButton, null}, - new Component[]{sevenFiveButton, null}, - new Component[]{fiveTenButton, null}, - new Component[]{twoFiveButton, null}, - new Component[]{selfAdaptButton, null}, - new Component[]{customButton, createSpinnerPanel()} - }; - dialogContentPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM, 0); - dialogContentPanel.setBackground(BACK_COLOR); - dialogContentPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - } - - private JPanel createSpinnerPanel() { - JPanel spinnerPanel = new JPanel(new FlowLayout()); - spinnerPanel.add(showValSpinner); - UILabel percent = new UILabel("%"); - percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); - spinnerPanel.add(percent); - spinnerPanel.setBackground(BACK_COLOR); - return spinnerPanel; - } - - private ActionListener showValButtonActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - popupDialog(); - } - }; - - private ChangeListener showValSpinnerChangeListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); - isButtonOrIsTxt = true; - 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); - refreshBottun(val); - JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); - textField.setCaretPosition(showValSpinner.getValue().toString().length()); - } - }; - - - //定义一个监听器,用于监听所有滑动条 - private ChangeListener listener = new ChangeListener() { - public void stateChanged(ChangeEvent event) { - //取出滑动条的值,并在文本中显示出来 - if (!isButtonOrIsTxt) { - customButton.setSelected(true); - EventQueue.invokeLater(new Runnable() { - public void run() { - sliderValue = slider.getValue(); - getTimes(sliderValue); - showValue = times; - showValSpinner.setValue(times); - customButton.setSelected(true); - } - }); - } else { - isButtonOrIsTxt = false; - } - } - }; - - private ItemListener radioButtonItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - JRadioButton temp = (JRadioButton) e.getSource(); - if (temp.isSelected()) { - showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%")))); - } - } - }; - - private void refreshSlider(int val) { - showValue = val; - if (showValue > HUNDRED) { - slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); - } else if (showValue < HUNDRED) { - slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); - } else { - slider.setValue(HALF_HUNDRED); - } - } - - - private void refreshBottun(int val) { - showValButton.setText(val + "%"); - } - - public double getResolutionTimes() { - return this.resolutionTimes; - } - - public int getshowValue() { - return this.showValue; - } - - public void reset() { - this.showValSpinner.setValue(HUNDRED); - } - - public static double divide(double v1, double v2, int scale) { - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.divide(b2, scale).doubleValue(); - } - - private ActionListener buttonActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - showValue = (int) showValSpinner.getValue(); - isButtonOrIsTxt = true; - if ("less".equals(e.getActionCommand())) { - int newDownVal = showValue - TEN; - if (newDownVal >= TEN) { - showValue = newDownVal; - showValSpinner.setValue(newDownVal); - } else { - showValue = newDownVal; - showValSpinner.setValue(TEN); - } - } - if ("more".equals(e.getActionCommand())) { - int newUpVal = showValue + TEN; - if (newUpVal <= FOUR_HUNDRED) { - showValue = newUpVal; - showValSpinner.setValue(newUpVal); - } else { - showValue = newUpVal; - showValSpinner.setValue(FOUR_HUNDRED); - } - } - isButtonOrIsTxt = true; - customButton.setSelected(true); - } - }; - - - private void getTimes(int value) { - if (value == HALF_HUNDRED) { - times = HUNDRED; - } else if (value < HALF_HUNDRED) { - times = (int) Math.round(ONEPOINTEIGHT * value + TEN); - } else { - times = SIX * value - TWO_HUNDRED; - } - } - - - public JSpinner getShowVal() { - return this.showValSpinner; - } - - public UIRadioButton getSelfAdaptButton() { - return this.selfAdaptButton; - } - - private void popupDialog() { - Point btnCoords = upButton.getLocationOnScreen(); - if (dialog == null) { - dialog = new PopupPane(upButton, dialogContentPanel); - if (upButtonX == 0) { - upButtonX = btnCoords.x; - GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height); - } - } else { - if (upButtonX == 0) { - upButtonX = btnCoords.x; - GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height); - } else { - GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height); - } - } - } - - public static void main(String[] args) { - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(new BorderLayout()); - content.add(JSliderPane.getInstance(), BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(400, 80); - jf.setVisible(true); - - } -} - -class JSliderPaneUI extends BasicSliderUI { - - private static final Color BACK_COLOR = new Color(245, 245, 247); - private static final int THUMB_XOFFSET = 8; - private static final int THUMB_YOFFSET = 3; - private static final int FOUR = 4; - private static final int FIVE = 5; - private static final int SIX = 6; - private static final int MID_X_SHIFT = 2; // 中点标记的水平位置偏移 - - public JSliderPaneUI(UISlider b) { - super(b); - } - - /** - * 绘制指示物 - */ - public void paintThumb(Graphics g) { - Rectangle knobBounds = thumbRect; - Graphics2D g2d = (Graphics2D) g; - g2d.drawImage(JSliderPane.APPFIT_V0, knobBounds.x - THUMB_XOFFSET, knobBounds.y + THUMB_YOFFSET, null); - g2d.dispose(); - } - - /** - * 绘制刻度轨迹 - */ - 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; - g2.setPaint(BACK_COLOR); - g2.fillRect(0, -cy, cw + 10, cy * 4); - g.setColor(new Color(216, 216, 216)); - g.drawLine(0, cy, cw + 3, cy); - g.drawLine(MID_X_SHIFT + cw / 2, cy - FOUR, MID_X_SHIFT + cw / 2, cy + FOUR); - } else { - super.paintTrack(g); - } - } - - public void setThumbLocation(int x, int y) { - super.setThumbLocation(x, y); - slider.repaint(); - } - -} - -class PopupPane extends UIPopupMenu { - private static final float REC = 8f; - private static final int INSERT_TOPBOTTOM = 10; - private static final int INSERT_LEFTRIGHT = 2; - private static final int DIALOG_WIDTH = 157; - private static final int DIALOG_HEIGHT = 205; - - PopupPane(JButton b, JPanel dialogContentPanel) { - this.add(dialogContentPanel, BorderLayout.CENTER); - this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); - this.setBackground(new Color(245, 245, 247)); - } - - public Insets getInsets() { - return new Insets(INSERT_TOPBOTTOM, INSERT_LEFTRIGHT, INSERT_TOPBOTTOM, INSERT_LEFTRIGHT); - } -} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index ec06a1597..60efed8c2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -311,6 +311,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme return new Dimension(this.getWidth(), this.getHeight()); } + public void paint(Graphics g) { + BufferedImage image = toData().getECImage(); + if (image != null) { + setLabelBackground(image.getScaledInstance(this.getWidth(), this.getHeight(), Image.SCALE_FAST), imageLable); + } + super.paint(g); + } + /** * 响应点击事件 * @param editingMouseListener 事件处理器 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java index 7083f087a..306da3907 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java @@ -85,8 +85,10 @@ public class XNumberEditor extends XWrapperedFieldEditor { NumberEditor editor = (NumberEditor) data; if (editor.getWidgetValue() != null) { Graphics2D g2d = (Graphics2D) g.create(); + FRFont font = FRFont.getInstance(); + float fontsize = (float) (font.getSize() * this.getScale()); BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), editor.getWidgetValue() - .toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) + .toString(), Style.getInstance(FRFont.getInstance().applySize(fontsize)).deriveHorizontalAlignment(Constants.LEFT) .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); } } @@ -96,10 +98,10 @@ public class XNumberEditor extends XWrapperedFieldEditor { setBorder(FIELDBORDER); return this; } - + @Override protected String getIconName() { return "number_field_16.png"; } - + } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 2376ecc94..be2dd2028 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -1375,4 +1375,10 @@ public class XWFitLayout extends XLayoutContainer { public void adjustCompSize(double percent) { this.adjustCreatorsWhileSlide(percent); } + + public void setScale(double scale) { + super.setScale(scale); + this.setContainerPercent(scale); + } + } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index 7f43c57df..842be5e64 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java @@ -25,18 +25,18 @@ import java.awt.Graphics2D; import java.awt.event.MouseEvent; public class XCardAddButton extends XButton { - + private XWCardTagLayout tagLayout; private XWCardLayout cardLayout; - + private static final int DEFAULT_BUTTON_WIDTH = 80; private static final int ICON_OFFSET = 8; - + private static Icon ADD_ICON = BaseUtils.readIcon("/com/fr/design/form/images/add.png"); private Icon addIcon = ADD_ICON; - + /** * card布局添加card按钮 */ @@ -65,7 +65,7 @@ public class XCardAddButton extends XButton { public XCardAddButton(CardAddButton widget, Dimension initSize) { super(widget, initSize); } - + /** * 构造函数 * @param widget 按钮 @@ -76,18 +76,18 @@ public class XCardAddButton extends XButton { this.tagLayout = fit; this.cardLayout = cardLayout; } - + /** * 响应点击事件 * @param editingMouseListener 事件处理器 * @param e 点击事件 - * + * */ @Override public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ FormDesigner designer = editingMouseListener.getDesigner(); designer.fireTargetModified(); - + // addbutton对应的XWCardLayout和XWCardTagLayout暂未存入到xml中,重新打开之后先根据父子层获取 if(cardLayout == null && tagLayout ==null ){ initRelateLayout(); @@ -96,17 +96,17 @@ public class XCardAddButton extends XButton { throw new IllegalArgumentException("cardLayout can not be null"); } int index = cardLayout.toData().getWidgetCount(); - + //添加新的tab,并将原来的设为未选中状态 setTabUnselected(); addTab(index); this.tagLayout.adjustComponentWidth(); - + if (editingMouseListener.stopEditing()) { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); } - + FormHierarchyTreePane.getInstance().refreshRoot(); //将焦点切换到新增的tab对应的tabfitLayout上 showNewTab(editingMouseListener,index); @@ -118,28 +118,28 @@ public class XCardAddButton extends XButton { public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { return UIPopupMenu.EMPTY; // 不要菜单 } - + private void initRelateLayout(){ XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent(); this.tagLayout = titleLayout.getTagPart(); - + XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent(); this.cardLayout = borderLayout.getCardPart(); } - + @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; drawAddIcon(g2d); } - + private void drawAddIcon(Graphics2D g2d){ int width = this.getWidth(); int height = this.getHeight(); addIcon.paintIcon(this, g2d, width / 2 - ICON_OFFSET, height / 2 - ICON_OFFSET); } - + //将原来的tab页设置为未选中状态 private void setTabUnselected(){ for(int i=0;i implements TreeSelection if (paraComponent != null) { return; } - paraHeight = WBorderLayout.DEFAULT_SIZE; paraComponent = new XWParameterLayout(); paraComponent.toData().setWidgetName("para"); paraComponent.setSize(paraComponent.initEditorSize()); + + paraComponent.setScale(rootComponent.getScale()); + this.setParaHeight(WBorderLayout.DEFAULT_SIZE); + paraComponent.setPreferredSize(new Dimension(paraComponent.getSize().width, this.getParaHeight())); + + + XWBorderLayout formLayoutContainer = (XWBorderLayout) rootComponent.getParent(); - formLayoutContainer.toData().setNorthSize(paraHeight); - formLayoutContainer.add(paraComponent, WBorderLayout.NORTH); //设下northSize,增加para后,重置border大小,这时候para和root的大小会自适应调整 - formLayoutContainer.setSize(formLayoutContainer.getWidth(), formLayoutContainer.getHeight() + paraHeight); + + formLayoutContainer.add(paraComponent, WBorderLayout.NORTH); + selectionModel.reset(); selectionModel.setSelectedCreator(paraComponent); invalidateLayout(); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index d76c2f891..0b0d43a0e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -88,9 +88,13 @@ public class WidgetBoundPane extends BasicPane { height.setValue(bounds.height); } + public void fix() { WLayout wabs = parent.toData(); CRBoundsWidget boundsWidget = wabs.getBoundsWidget(creator.toData()); + if (boundsWidget == null){ + return; + } Rectangle bounds = new Rectangle(boundsWidget.getBounds()); creator.setBackupBound(creator.getBounds()); int w = (int) width.getValue(); @@ -106,18 +110,17 @@ public class WidgetBoundPane extends BasicPane { public void adjustComponents(Rectangle bounds, int difference, int row) { - double scale = parent.getScale(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); Rectangle backupBounds = getBound(); FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, creator); if (layoutAdapter != null) { layoutAdapter.setEdit(true); - layoutAdapter.calculateBounds(backupBounds, new Rectangle((int) (bounds.x * scale), (int) (bounds.y * scale), (int) (bounds.width * scale), (int) (bounds.height * scale)), creator, row, difference); + layoutAdapter.calculateBounds(backupBounds, bounds, creator, row, difference); } } public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec) { - int difference = 0; + int scaleDiff = 0; double scale = parent.getScale(); int minWidth = (int) (MINWIDTH * ((WFitLayout) wabs).getResolutionScaling()); PaddingMargin margin = wabs.getMargin(); @@ -131,16 +134,27 @@ public class WidgetBoundPane extends BasicPane { width.setValue(bounds.width); return; } - difference = bounds.width - w; + int difference = bounds.width - w; + scaleDiff = roundValue(difference * scale); bounds.width = w; } + Rectangle backupBounds = getBound(); + Rectangle newBounds = new Rectangle(backupBounds.x, backupBounds.y, backupBounds.width - scaleDiff, backupBounds.height); wabs.setBounds(creator.toData(), bounds); - adjustComponents(bounds, difference, 0); + adjustComponents(newBounds, scaleDiff, 0); + } + + private int roundValue(double value) { + if (value < 0) { + return (int) Math.floor(value); + } else { + return (int) Math.ceil(value); + } } public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec) { double scale = parent.getScale(); - int difference = 0; + int scaleDiff = 0; PaddingMargin margin = wabs.getMargin(); int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling()); if (bounds.height != h) { @@ -153,11 +167,14 @@ public class WidgetBoundPane extends BasicPane { height.setValue(bounds.height); return; } - difference = bounds.height - h; + int difference = bounds.height - h; + scaleDiff = roundValue(difference * scale); bounds.height = h; } + Rectangle backupBounds = getBound(); + Rectangle newBounds = new Rectangle(backupBounds.x, backupBounds.y, backupBounds.width, backupBounds.height - scaleDiff); wabs.setBounds(creator.toData(), bounds); - adjustComponents(bounds, difference, 1); + adjustComponents(newBounds, scaleDiff, 1); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java index 0299899a0..4b74ab4dd 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java @@ -7,7 +7,6 @@ import com.fr.design.event.RemoveListener; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.icontainer.UIModeControlContainer; -import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.grid.Grid; import com.fr.log.FineLoggerFactory; @@ -49,7 +48,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen private JPanel hbarContainer; - private JSliderPane jSliderContainer; + private JFormSliderPane jSliderContainer; /** * Constructor with workbook.. @@ -65,8 +64,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(CellElementRegion, BorderLayout.NORTH); this.add(createSouthControlPane(), BorderLayout.SOUTH); - jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); - jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); + jSliderContainer.addValueChangeListener(showValSpinnerChangeListener); } MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { @@ -74,8 +72,8 @@ public class ReportComponentComposite extends JComponent implements RemoveListen public void mouseWheelMoved(MouseWheelEvent e) { if (InputEventBaseOnOS.isControlDown(e)) { int dir = e.getWheelRotation(); - int old_resolution = (int) jSliderContainer.getShowVal().getValue(); - jSliderContainer.getShowVal().setValue(old_resolution - (dir * DIR)); + int old_resolution = jSliderContainer.getShowValue(); + jSliderContainer.setShowValue(old_resolution - (dir * DIR)); } } }; @@ -83,7 +81,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen ChangeListener showValSpinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - double value = (int) ((UIBasicSpinner) e.getSource()).getValue(); + double value = jSliderContainer.getShowValue(); value = value > MAX ? MAX : value; value = value < MIN ? MIN : value; int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND); @@ -91,15 +89,6 @@ public class ReportComponentComposite extends JComponent implements RemoveListen } }; - ItemListener selfAdaptButtonItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (jSliderContainer.getSelfAdaptButton().isSelected()) { - int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().selfAdaptUpdate(); - jSliderContainer.getShowVal().setValue(resolution * HUND / ScreenResolution.getScreenResolution()); - } - } - }; protected void doBeforeChange(int oldIndex) { if (oldIndex >= 0) { @@ -130,8 +119,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen templateStateList.add(null); } centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement()); - jSliderContainer=JSliderPane.getInstance(); - jSliderContainer.reset(); + jSliderContainer = JFormSliderPane.getInstance(); } if (centerCardPane.editingComponet.elementCasePane == null) { @@ -173,7 +161,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen return sheetNameTab.getSelectedIndex(); } - public JSliderPane getjSliderContainer() { + public JFormSliderPane getjSliderContainer() { return this.jSliderContainer; } @@ -217,7 +205,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); JPanel southPane = new JPanel(new BorderLayout()); - jSliderContainer = JSliderPane.getInstance(); + jSliderContainer = JFormSliderPane.getInstance(); southPane.add(hbarContainer, BorderLayout.NORTH); southPane.add(sheetNameTab, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java index 707169447..da7548013 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java @@ -182,8 +182,8 @@ public class WorkSheetDesigner extends ReportComponent MAX ? MAX : value; value = value < MIN ? MIN : value; int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND); @@ -81,15 +80,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo } }; - ItemListener selfAdaptButtonItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (jSliderContainer.getSelfAdaptButton().isSelected()) { - int resolution = selfAdaptUpdate(); - jSliderContainer.getShowVal().setValue(resolution * HUND / ScreenResolution.getScreenResolution()); - } - } - }; + private java.util.List targetModifiedList = new java.util.ArrayList(); @@ -169,7 +160,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo JPanel southPane = new JPanel(new BorderLayout()); hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); hbarContainer.add(elementCaseDesigner.getHorizontalScrollBar()); - jSliderContainer = JSliderPane.getInstance(); + jSliderContainer = JFormSliderPane.getInstance(); southPane.add(hbarContainer, BorderLayout.NORTH); southPane.add(sheetNameTab, BorderLayout.CENTER); @@ -204,4 +195,4 @@ public class FormReportComponentComposite extends JComponent implements TargetMo } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/grid/GridColumn.java b/designer-realize/src/main/java/com/fr/grid/GridColumn.java index 910fac6ec..8ba6484bc 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridColumn.java +++ b/designer-realize/src/main/java/com/fr/grid/GridColumn.java @@ -10,7 +10,6 @@ import com.fr.base.ScreenResolution; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.GridUIProcessor; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JSliderPane; import com.fr.stable.StableUtils; import javax.swing.plaf.ComponentUI; @@ -75,4 +74,4 @@ public class GridColumn extends GridHeader { return new Dimension(super.getPreferredSize().width, (int) (GraphHelper.getFontMetrics(this.getFont()).getHeight() * time + SIZE_ADJUST)); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index 86ed09161..b0f91a902 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -9,7 +9,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JSliderPane; import com.fr.design.os.impl.PopupDialogSaveAction; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.grid.selection.CellSelection; @@ -74,7 +73,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private int ECBlockGap = 40; - private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes); + private int resolution = ScreenResolution.getScreenResolution(); protected GridMouseAdapter(Grid grid) { this.grid = grid; @@ -836,4 +835,4 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous */ public void mouseExited(MouseEvent e) { } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/grid/GridUtils.java b/designer-realize/src/main/java/com/fr/grid/GridUtils.java index 11e907fc6..80e6f3ff5 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUtils.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUtils.java @@ -6,7 +6,6 @@ import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JSliderPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.grid.selection.CellSelection; @@ -125,8 +124,7 @@ public class GridUtils { */ public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList, int verticalValue, int horizentalValue) { - int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes); - + int resolution = ScreenResolution.getScreenResolution(); double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution); double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution); @@ -179,7 +177,7 @@ public class GridUtils { private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) { double tmpIntIndex = 0; int selectedCellIndex = 0; - int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes); + int resolution = ScreenResolution.getScreenResolution(); if (mouseEvtPosition < 0) { selectedCellIndex = value; for (; true; selectedCellIndex--) { @@ -487,4 +485,4 @@ public class GridUtils { } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java index 8397db820..bffb625fe 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java @@ -25,7 +25,7 @@ import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePaneAuthorityEditPane; import com.fr.design.mainframe.FormScrollBar; -import com.fr.design.mainframe.JSliderPane; +import com.fr.design.mainframe.JFormSliderPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.NoSupportAuthorityEdit; import com.fr.design.mainframe.ReportComponent; @@ -124,8 +124,7 @@ public class PolyDesigner extends ReportComponent