Browse Source

SonarQube

master
hzzz 7 years ago
parent
commit
1bbcf2269c
  1. 10
      designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  2. 33
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java
  3. 9
      designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java
  4. 35
      designer_base/src/com/fr/design/gui/ispinner/UISpinner.java
  5. 18
      designer_base/src/com/fr/design/gui/itextarea/UITextArea.java
  6. 49
      designer_base/src/com/fr/design/gui/itextfield/UINumberField.java

10
designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -155,14 +155,4 @@ public class CustomStylePane extends MultiTabPane<Style> {
// paneList.add(backgroundPane = new BackgroundPane()); // paneList.add(backgroundPane = new BackgroundPane());
return paneList; return paneList;
} }
@Override
/**
*
*/
public void updateBean(Style ob) {
}
} }

33
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -7,6 +7,7 @@ import com.fr.design.event.GlobalNameObserver;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
@ -28,7 +29,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
protected int selectedIndex = -1; protected int selectedIndex = -1;
private List<T> objectList;// 起到一个render的作用 private List<T> objectList;// 起到一个render的作用
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private String buttonGroupName = ""; private String buttonGroupName = StringUtils.EMPTY;
private boolean isToolBarComponent = false; private boolean isToolBarComponent = false;
private boolean isClick; private boolean isClick;
@ -341,21 +342,21 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
* @param args * @param args
*/ */
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());
Icon[] a1 = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), // Icon[] a1 = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; // BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
Integer[] a2 = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; // Integer[] a2 = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
UIButtonGroup<Integer> bb = new UIButtonGroup<Integer>(a1, a2); // UIButtonGroup<Integer> bb = new UIButtonGroup<Integer>(a1, a2);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); // bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
bb.setSelectedIndex(0); // bb.setSelectedIndex(0);
bb.setEnabled(false); // bb.setEnabled(false);
content.add(bb); // content.add(bb);
GUICoreUtils.centerWindow(jf); // GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400); // jf.setSize(400, 400);
jf.setVisible(true); // jf.setVisible(true);
} }

9
designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java

@ -12,15 +12,6 @@ public class UITabGroup extends UIButtonGroup<Integer> {
private static final int ORIGINAL_WIDTH = 10; private static final int ORIGINAL_WIDTH = 10;
private static final int GAP = 11; private static final int GAP = 11;
/**
* 标签页改变
*
* @param index 序号
*/
public void tabChanged(int index) {
}
public UITabGroup(Icon[] iconArray) { public UITabGroup(Icon[] iconArray) {
super(iconArray, new Integer[iconArray.length]); super(iconArray, new Integer[iconArray.length]);
setSelectedIndex(0); setSelectedIndex(0);

35
designer_base/src/com/fr/design/gui/ispinner/UISpinner.java

@ -9,6 +9,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -23,13 +24,15 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
protected double value; protected double value;
private static final int SIZE = 20; private static final int SIZE = 20;
private static final int LEN = 13; private static final int LEN = 13;
private static final int WIDTH = 13;
private static final int HEIGHT = 10;
private UINumberField textField; private UINumberField textField;
private UIButton preButton; private UIButton preButton;
private UIButton nextButton; private UIButton nextButton;
private double minValue; private double minValue;
private double maxValue; private double maxValue;
private double dierta; private double dierta;
private String spinnerName = ""; private String spinnerName = StringUtils.EMPTY;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
@ -184,8 +187,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
JPanel arrowPane = new JPanel(); JPanel arrowPane = new JPanel();
arrowPane.setPreferredSize(new Dimension(LEN, SIZE)); arrowPane.setPreferredSize(new Dimension(LEN, SIZE));
arrowPane.setLayout(new GridLayout(2, 1)); arrowPane.setLayout(new GridLayout(2, 1));
preButton.setBounds(0, 1, 13, 10); preButton.setBounds(0, 1, WIDTH, HEIGHT);
nextButton.setBounds(0, 10, 13, 10); nextButton.setBounds(0, HEIGHT, WIDTH, HEIGHT);
arrowPane.add(preButton); arrowPane.add(preButton);
arrowPane.add(nextButton); arrowPane.add(nextButton);
add(arrowPane, BorderLayout.EAST); add(arrowPane, BorderLayout.EAST);
@ -291,18 +294,18 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
* @param args 参数 * @param args 参数
*/ */
public static void main(String... args) { public static void main(String... args) {
LayoutManager layoutManager = null; // LayoutManager layoutManager = null;
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(layoutManager); // content.setLayout(layoutManager);
//
UISpinner bb = new UISpinner(0, 9, 1); // UISpinner bb = new UISpinner(0, 9, 1);
bb.setValue(4); // bb.setValue(4);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); // bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb); // content.add(bb);
GUICoreUtils.centerWindow(jf); // GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400); // jf.setSize(400, 400);
jf.setVisible(true); // jf.setVisible(true);
} }
} }

18
designer_base/src/com/fr/design/gui/itextarea/UITextArea.java

@ -122,14 +122,14 @@ public class UITextArea extends JTextArea implements UIObserver {
* @param args * @param args
*/ */
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());
UITextArea bb = new UITextArea("123455weoijweio reiwj kewl jfejkfljds kl jfldk jfk jdskfjkdsfklj dkl jfsdjf"); // UITextArea bb = new UITextArea("123455weoijweio reiwj kewl jfejkfljds kl jfldk jfk jdskfjkdsfklj dkl jfsdjf");
content.add(bb, BorderLayout.CENTER); // content.add(bb, BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf); // GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400); // jf.setSize(400, 400);
jf.setVisible(true); // jf.setVisible(true);
} }
} }

49
designer_base/src/com/fr/design/gui/itextfield/UINumberField.java

@ -17,24 +17,27 @@ import java.awt.*;
*/ */
public class UINumberField extends UITextField { public class UINumberField extends UITextField {
public static final double ERROR_VALUE = Double.MAX_VALUE + 4.44; // peter:错误的值. public static final double ERROR_VALUE = Double.MAX_VALUE + 4.44; // peter:错误的值.
public static final int MAX_INTEGERLENGTH = 24;
public static final int MAX_INTEGERLENGTH_32 = 32;
public static final int MAX_DECIMALLENGTH = 16;
/** /**
* 整数部分的长度 * 整数部分的长度
*/ */
private int maxIntegerLength = 24; private int maxIntegerLength = MAX_INTEGERLENGTH;
/** /**
* 小数部分的长度 * 小数部分的长度
*/ */
private static final int DEFAULTMAXDECIMALLENTH = 16; private static final int DEFAULTMAXDECIMALLENTH = 16;
private static final int TESTMAXVALUE = 100; private static final int TESTMAXVALUE = 100;
private static final int TESTMINVALUE = -10; private static final int TESTMINVALUE = -10;
private int maxDecimalLength = 16; private int maxDecimalLength = MAX_DECIMALLENGTH;
private double minValue = -Double.MAX_VALUE; private double minValue = -Double.MAX_VALUE;
private double maxValue = Double.MAX_VALUE; private double maxValue = Double.MAX_VALUE;
private boolean isContentChanged = false; private boolean isContentChanged = false;
public UINumberField() { public UINumberField() {
this(32, 16); this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH);
} }
public UINumberField(int columns) { public UINumberField(int columns) {
@ -150,8 +153,6 @@ public class UINumberField extends UITextField {
} }
class NumberDocument extends PlainDocument { class NumberDocument extends PlainDocument {
public NumberDocument() {
}
public boolean checkString(int offset, String s, String str) { public boolean checkString(int offset, String s, String str) {
return (ComparatorUtils.equals(s, "F") return (ComparatorUtils.equals(s, "F")
@ -216,9 +217,9 @@ public class UINumberField extends UITextField {
} }
private boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { private boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) {
return strIntPart.length() > maxIntegerLength boolean checkLength = strIntPart.length() > maxIntegerLength
|| strDecPart.length() > maxDecimalLength || strDecPart.length() > maxDecimalLength;
|| (strNew.length() > 1 && ComparatorUtils.equals(strNew.substring(0, 1), "0") && !ComparatorUtils.equals(strNew.substring(1, 2), ".")); return checkLength || (strNew.length() > 1 && ComparatorUtils.equals(strNew.substring(0, 1), "0") && !ComparatorUtils.equals(strNew.substring(1, 2), "."));
} }
} }
@ -226,21 +227,21 @@ public class UINumberField extends UITextField {
* 测试程序 * 测试程序
*/ */
public static void main(String[] args) { public static void main(String[] args) {
JFrame frame = new JFrame(""); // JFrame frame = new JFrame("");
frame.setSize(400, 320); // frame.setSize(400, 320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); // Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2); // frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
UINumberField tt = new UINumberField(); // UINumberField tt = new UINumberField();
tt.setMinValue(0.0); // tt.setMinValue(0.0);
tt.setMaxValue(100.0); // tt.setMaxValue(100.0);
frame.getContentPane().setLayout(new GridLayout(10, 2)); // frame.getContentPane().setLayout(new GridLayout(10, 2));
frame.getContentPane().add(new UILabel("New JNumberField()")); // frame.getContentPane().add(new UILabel("New JNumberField()"));
frame.getContentPane().add(tt); // frame.getContentPane().add(tt);
frame.getContentPane().add(new UILabel("New JNumberField(2)")); // frame.getContentPane().add(new UILabel("New JNumberField(2)"));
frame.getContentPane().add(new UILabel("New JNumberField(8,2)")); // frame.getContentPane().add(new UILabel("New JNumberField(8,2)"));
frame.getContentPane().add(new UINumberField(8, 2)); // frame.getContentPane().add(new UINumberField(8, 2));
frame.getContentPane().add(new UILabel("New JNumberField(5,2,-10,100)")); // frame.getContentPane().add(new UILabel("New JNumberField(5,2,-10,100)"));
frame.getContentPane().add(new UINumberField(5, 2, TESTMINVALUE, TESTMAXVALUE)); // frame.getContentPane().add(new UINumberField(5, 2, TESTMINVALUE, TESTMAXVALUE));
frame.setVisible(true); // frame.setVisible(true);
} }
} }
Loading…
Cancel
Save