Browse Source

代码格式化

master
MoMeak 7 years ago
parent
commit
9024ca56b8
  1. 24
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  2. 55
      designer/src/com/fr/poly/PolyDesigner.java
  3. 14
      designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
  4. 20
      designer_base/src/com/fr/design/mainframe/JSliderPane.java

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

@ -1,17 +1,5 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.BorderLayout;
import java.awt.event.*;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
@ -23,9 +11,15 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyArea;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
/** /**
* 整个报表编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab * 整个报表编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab
* *
@ -56,7 +50,6 @@ public class ReportComponentComposite extends JComponent {
/** /**
* Constructor with workbook.. * Constructor with workbook..
*
*/ */
public ReportComponentComposite(JWorkBook jwb) { public ReportComponentComposite(JWorkBook jwb) {
setFocusable(true); setFocusable(true);
@ -80,12 +73,14 @@ public class ReportComponentComposite extends JComponent {
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
} }
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.isControlDown()) { if (e.isControlDown()) {
isCtrl = true; isCtrl = true;
} }
} }
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
isCtrl = false; isCtrl = false;
@ -169,7 +164,6 @@ public class ReportComponentComposite extends JComponent {
* 移除选中状态 * 移除选中状态
* *
* @date 2015-2-5-上午11:41:44 * @date 2015-2-5-上午11:41:44
*
*/ */
public void removeSelection() { public void removeSelection() {
if (centerCardPane.editingComponet instanceof WorkSheetDesigner) { if (centerCardPane.editingComponet instanceof WorkSheetDesigner) {

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

@ -3,20 +3,6 @@
*/ */
package com.fr.poly; package com.fr.poly;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
@ -47,11 +33,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.poly.actions.DeleteBlockAction; import com.fr.poly.actions.DeleteBlockAction;
import com.fr.poly.creator.BlockCreator; import com.fr.poly.creator.*;
import com.fr.poly.creator.BlockEditor;
import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.creator.ECBlockEditor;
import com.fr.poly.creator.PolyElementCasePane;
import com.fr.poly.hanlder.DataEditingListener; import com.fr.poly.hanlder.DataEditingListener;
import com.fr.poly.hanlder.PolyDesignerDropTarget; import com.fr.poly.hanlder.PolyDesignerDropTarget;
import com.fr.poly.model.AddedData; import com.fr.poly.model.AddedData;
@ -61,13 +43,21 @@ import com.fr.report.block.Block;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.poly.TemplateBlock; import com.fr.report.poly.TemplateBlock;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.OLDPIX;
import com.fr.stable.unit.UNIT; import com.fr.stable.unit.UNIT;
import com.fr.stable.unit.UnitRectangle; import com.fr.stable.unit.UnitRectangle;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author richer * @author richer
* @since 6.5.3 聚合报表的设计块不包括底部和右边的滚动条以及左边和上边的像素标识条 * @since 6.5.3 聚合报表的设计块不包括底部和右边的滚动条以及左边和上边的像素标识条
@ -85,6 +75,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
public static enum SelectionType { public static enum SelectionType {
NONE, INNER, BLOCK NONE, INNER, BLOCK
} }
public JComponent polyArea; public JComponent polyArea;
private SelectionType selectedtype = SelectionType.NONE; private SelectionType selectedtype = SelectionType.NONE;
private AddingData addingData; private AddingData addingData;
@ -171,12 +162,14 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
} }
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.isControlDown()) { if (e.isControlDown()) {
isCtrl = true; isCtrl = true;
} }
} }
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
isCtrl = false; isCtrl = false;
@ -209,6 +202,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 是否含有聚和报表块 * 是否含有聚和报表块
*
* @param targetComponent 目标组件 * @param targetComponent 目标组件
* @return 是则返回true * @return 是则返回true
*/ */
@ -249,6 +243,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 增加组件 * 增加组件
*
* @param currentEditor 组件 * @param currentEditor 组件
*/ */
public void addEditor(BlockEditor currentEditor) { public void addEditor(BlockEditor currentEditor) {
@ -257,6 +252,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 移除组件 * 移除组件
*
* @param currentEditor 组件 * @param currentEditor 组件
*/ */
public void removeEditor(BlockEditor currentEditor) { public void removeEditor(BlockEditor currentEditor) {
@ -265,6 +261,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 权限编辑状态 * 权限编辑状态
*
* @return 权限编辑面板 * @return 权限编辑面板
*/ */
public AuthorityEditPane createAuthorityEditPane() { public AuthorityEditPane createAuthorityEditPane() {
@ -300,6 +297,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 增加组件 * 增加组件
*
* @param creator 组件 * @param creator 组件
*/ */
public void addBlockCreator(BlockCreator creator) { public void addBlockCreator(BlockCreator creator) {
@ -386,6 +384,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 选中的是否是报表块 * 选中的是否是报表块
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean isSelectedECBolck() { public boolean isSelectedECBolck() {
@ -410,7 +409,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
} }
/** /**
* @return * @return
*/ */
@ -461,6 +459,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 黏贴 * 黏贴
*
* @return 黏贴成功返回true * @return 黏贴成功返回true
*/ */
public boolean paste() { public boolean paste() {
@ -520,6 +519,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 删除 * 删除
*
* @return 删除成功返回true * @return 删除成功返回true
*/ */
public boolean delete() { public boolean delete() {
@ -559,6 +559,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 剪切 * 剪切
*
* @return 剪切成功返回true * @return 剪切成功返回true
*/ */
public boolean cut() { public boolean cut() {
@ -569,6 +570,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 移动 * 移动
*
* @param x 横坐标 * @param x 横坐标
* @param y 纵坐标 * @param y 纵坐标
*/ */
@ -687,6 +689,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 开始编辑 * 开始编辑
*
* @param blockName 聚合块名称 * @param blockName 聚合块名称
*/ */
public void startEditing(String blockName) { public void startEditing(String blockName) {
@ -919,6 +922,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 是否选中聚合块本身 * 是否选中聚合块本身
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean isChooseBlock() { public boolean isChooseBlock() {
@ -967,6 +971,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 计算滚动条的值和max * 计算滚动条的值和max
*
* @param oldmax 之前最大值 * @param oldmax 之前最大值
* @param max 当前最大值 * @param max 当前最大值
* @param newValue 当前value * @param newValue 当前value
@ -983,7 +988,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* 获取当前聚合报表区域左上角x坐标 * 获取当前聚合报表区域左上角x坐标
* *
* @return 当前聚合报表区域左上角x坐标 * @return 当前聚合报表区域左上角x坐标
*
*/ */
public double getAreaLocationX() { public double getAreaLocationX() {
return polyArea.getLocationOnScreen().getX(); return polyArea.getLocationOnScreen().getX();
@ -993,7 +997,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* 获取当前聚合报表区域左上角y坐标 * 获取当前聚合报表区域左上角y坐标
* *
* @return 当前聚合报表区域左上角y坐标 * @return 当前聚合报表区域左上角y坐标
*
*/ */
public double getAreaLocationY() { public double getAreaLocationY() {
return polyArea.getLocationOnScreen().getY(); return polyArea.getLocationOnScreen().getY();
@ -1003,9 +1006,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* 检测指定块是否与其他的块有重叠区域 * 检测指定块是否与其他的块有重叠区域
* *
* @param creator 指定的块编辑器 * @param creator 指定的块编辑器
*
* @return 是否与其他的块有重叠区域 * @return 是否与其他的块有重叠区域
*
*/ */
public boolean intersectsAllBlock(BlockCreator creator) { public boolean intersectsAllBlock(BlockCreator creator) {
return intersectsAllBlock(creator.getValue()); return intersectsAllBlock(creator.getValue());
@ -1015,9 +1016,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* 检测指定块是否与其他的块有重叠区域 * 检测指定块是否与其他的块有重叠区域
* *
* @param block 指定的块 * @param block 指定的块
*
* @return 是否与其他的块有重叠区域 * @return 是否与其他的块有重叠区域
*
*/ */
public boolean intersectsAllBlock(TemplateBlock block) { public boolean intersectsAllBlock(TemplateBlock block) {
UnitRectangle rec = block.getBounds(); UnitRectangle rec = block.getBounds();
@ -1030,9 +1029,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* *
* @param rec 指定的块区域 * @param rec 指定的块区域
* @param blockName 指定的块名称 * @param blockName 指定的块名称
*
* @return 是否与其他的块有重叠区域 * @return 是否与其他的块有重叠区域
*
*/ */
public boolean intersectsAllBlock(UnitRectangle rec, String blockName) { public boolean intersectsAllBlock(UnitRectangle rec, String blockName) {
PolyWorkSheet worksheet = this.getTarget(); PolyWorkSheet worksheet = this.getTarget();

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

@ -16,9 +16,11 @@ import javax.swing.*;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
@ -197,8 +199,7 @@ public class JFormSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() ChangeListener listener = new ChangeListener() {
{
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -288,7 +289,6 @@ public class JFormSliderPane extends JPanel {
}; };
private void getTimes(int value) { private void getTimes(int value) {
if (value == HALF_HUNDRED) { if (value == HALF_HUNDRED) {
times = HUNDRED; times = HUNDRED;
@ -326,8 +326,7 @@ public class JFormSliderPane extends JPanel {
} }
} }
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();
@ -349,6 +348,7 @@ class FormPopupPane extends JPopupMenu {
private static final int UPLABEL_WIDTH = 300; private static final int UPLABEL_WIDTH = 300;
private JComponent centerPane; private JComponent centerPane;
private UILabel upLabel; private UILabel upLabel;
FormPopupPane(UIButton b, JPanel dialogContentPanel) { FormPopupPane(UIButton b, JPanel dialogContentPanel) {
contentPane = new JPanel(new BorderLayout()); contentPane = new JPanel(new BorderLayout());
centerPane = new JPanel(new BorderLayout()); centerPane = new JPanel(new BorderLayout());

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

@ -18,7 +18,10 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI; import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
@ -196,8 +199,7 @@ public class JSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() ChangeListener listener = new ChangeListener() {
{
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -287,7 +289,6 @@ public class JSliderPane extends JPanel {
}; };
private void getTimes(int value) { private void getTimes(int value) {
if (value == HALF_HUNDRED) { if (value == HALF_HUNDRED) {
times = HUNDRED; times = HUNDRED;
@ -325,8 +326,7 @@ public class JSliderPane extends JPanel {
} }
} }
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();
@ -362,8 +362,7 @@ class JSliderPaneUI extends BasicSliderUI {
if (slider.getOrientation() == JSlider.VERTICAL) { if (slider.getOrientation() == JSlider.VERTICAL) {
size.width = VERTICAL_WIDTH; size.width = VERTICAL_WIDTH;
size.height = VERTICAL_HEIGHT; size.height = VERTICAL_HEIGHT;
} } else {
else {
size.width = VERTICAL_WIDTH; size.width = VERTICAL_WIDTH;
size.height = VERTICAL_HEIGHT; size.height = VERTICAL_HEIGHT;
} }
@ -379,8 +378,7 @@ class JSliderPaneUI extends BasicSliderUI {
g.translate(knobBounds.x, knobBounds.y); g.translate(knobBounds.x, knobBounds.y);
if (slider.isEnabled()) { if (slider.isEnabled()) {
g.setColor(slider.getBackground()); g.setColor(slider.getBackground());
} } else {
else {
g.setColor(slider.getBackground().darker()); g.setColor(slider.getBackground().darker());
} }
g.setColor(Color.darkGray); g.setColor(Color.darkGray);
@ -416,6 +414,7 @@ class PopupPane extends JPopupMenu {
private static final int UPLABEL_WIDTH = 300; private static final int UPLABEL_WIDTH = 300;
private JComponent centerPane; private JComponent centerPane;
private UILabel upLabel; private UILabel upLabel;
PopupPane(UIButton b, JPanel dialogContentPanel) { PopupPane(UIButton b, JPanel dialogContentPanel) {
contentPane = new JPanel(new BorderLayout()); contentPane = new JPanel(new BorderLayout());
centerPane = new JPanel(new BorderLayout()); centerPane = new JPanel(new BorderLayout());
@ -434,5 +433,4 @@ class PopupPane extends JPopupMenu {
} }
} }
Loading…
Cancel
Save