XiaXiang 8 years ago
parent
commit
6d7029125d
  1. 9
      designer/src/com/fr/design/report/UnitFieldPane.java
  2. 23
      designer_base/src/com/fr/common/inputevent/InputEventBaseOnOS.java
  3. 3
      designer_base/src/com/fr/design/gui/frpane/UITextPane.java
  4. 24
      designer_base/src/com/fr/design/gui/itextarea/UITextArea.java
  5. 16
      designer_base/src/com/fr/design/gui/itextfield/UINumberField.java
  6. 27
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  7. 4
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  8. 4
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  9. 4
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  10. 4
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  11. 4
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  12. 19
      designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java

9
designer/src/com/fr/design/report/UnitFieldPane.java

@ -6,6 +6,8 @@ package com.fr.design.report;
import java.awt.Dimension;
import javax.swing.JFormattedTextField;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
@ -42,11 +44,11 @@ public class UnitFieldPane extends JPanel {
public void setUnitType(int unitType) {
if (unitType == Constants.UNIT_CM) {
this.setText(Inter.getLocText("Unit_CM"));
this.setText(Inter.getLocText("FR-Designer_Unit_CM"));
} else if (unitType == Constants.UNIT_INCH) {
this.setText(Inter.getLocText("PageSetup-inches"));
this.setText(Inter.getLocText("FR-Designer_Unit_INCH"));
} else {
this.setText(Inter.getLocText("PageSetup-mm"));
this.setText(Inter.getLocText("FR-Designer_Unit_MM-mm"));
}
//ajust the heigt of unitLabel.
@ -67,6 +69,7 @@ public class UnitFieldPane extends JPanel {
valueSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0));
textField = ((JSpinner.DefaultEditor) valueSpinner.getEditor()).getTextField();
textField.setColumns(4);
InputEventBaseOnOS.addBasicEditInputMap(textField);
this.add(valueSpinner);
unitLable = new UnitLabel(unitType, valueSpinner.getPreferredSize().height);
this.add(unitLable);

23
designer_base/src/com/fr/common/inputevent/InputEventBaseOnOS.java

@ -2,9 +2,13 @@ package com.fr.common.inputevent;
import com.fr.stable.OperatingSystem;
import javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* Created by hzzz on 2017/5/26.
*/
@ -18,4 +22,23 @@ public class InputEventBaseOnOS {
public static boolean isControlDown(KeyEvent e) {
return IS_MACOS ? e.isMetaDown() : e.isControlDown();
}
public static void addBasicEditInputMap(JComponent jComponent) {
InputMap inputMap = jComponent.getInputMap();
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
}
}

3
designer_base/src/com/fr/design/gui/frpane/UITextPane.java

@ -1,5 +1,6 @@
package com.fr.design.gui.frpane;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
@ -22,11 +23,13 @@ public class UITextPane extends JTextPane implements UIObserver {
public UITextPane() {
super();
InputEventBaseOnOS.addBasicEditInputMap(this);
iniListener();
}
public UITextPane(StyledDocument doc) {
super(doc);
InputEventBaseOnOS.addBasicEditInputMap(this);
iniListener();
}

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

@ -1,5 +1,6 @@
package com.fr.design.gui.itextarea;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.GUICoreUtils;
@ -7,33 +8,14 @@ import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class UITextArea extends JTextArea implements UIObserver {
private UIObserverListener uiObserverListener;
public UITextArea(int i, int j) {
super(i, j);
InputMap inputMap = this.getInputMap();
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents();
}
@ -44,11 +26,13 @@ public class UITextArea extends JTextArea implements UIObserver {
public UITextArea() {
super();
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents();
}
public UITextArea(String s) {
super(s);
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents();
}

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

@ -1,20 +1,17 @@
package com.fr.design.gui.itextfield;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import com.fr.base.Utils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.*;
/**
* Number Field.
*/
@ -54,7 +51,6 @@ public class UINumberField extends UITextField {
this.maxDecimalLength = maxDecimalLength;
this.minValue = minValue;
this.maxValue = maxValue;
setFieldDocument();
}

27
designer_base/src/com/fr/design/gui/itextfield/UITextField.java

@ -1,5 +1,6 @@
package com.fr.design.gui.itextfield;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
@ -10,12 +11,8 @@ import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Document;
import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* @author Jerry
@ -31,42 +28,32 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() {
super();
InputMap inputMap = this.getInputMap();
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(int columns) {
super(columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(String text, int columns) {
super(text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(String text) {
super(text);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(Document doc, String text, int columns) {
super(doc, text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}

4
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -1044,7 +1044,7 @@ FR-Designer-Tree_Width=Tree Width
Record=Record
Poly-Report_Component=Aggregate Report Component
Options=Options
NS-war-remote=Error codes\:1117 Compression deployment does not support remote design
NS-war-remote=Error codes\:11100017 Compression deployment does not support remote design
Sche-Minute=Minute
Three_Rows_Of_Three_Grid=A grid with 3 rows and 3 columns
WorkSheet=Free Report
@ -1412,7 +1412,7 @@ Rename=Rename
Widget-Load_By_Async=Async load
Shape=Shape
BindColumn-This_Condition_has_been_existed=The Condition Already Exists
NS-exception_readError=Error codes\:1305 Template file parsing error
NS-exception_readError=Error codes\:11300005 Template file parsing error
Set_Column_Title_Start=Set Duplicate Title Columns
Fri=Fri
M_Report-Report_Parameter=Report Parameter

4
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1039,7 +1039,7 @@ FR-Designer-Tree_Width=\u5E45
Record=\u8A18\u9332
Poly-Report_Component=\u805A\u5408\u5E33\u7968\u30A2\u30BB\u30F3\u30D6\u30EA
Options=\u30AA\u30D7\u30B7\u30E7\u30F3
NS-war-remote=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:1117 \u5727\u7E2E\u914D\u7F6E\u306F\u9060\u9694\u30C7\u30B6\u30A4\u30F3\u306B\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093
NS-war-remote=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:11100017 \u5727\u7E2E\u914D\u7F6E\u306F\u9060\u9694\u30C7\u30B6\u30A4\u30F3\u306B\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093
Sche-Minute=\u5206
Three_Rows_Of_Three_Grid=3\u4E57\u306E3\u3064\u306E\u884C
WorkSheet=\u30EF\u30FC\u30AF\u30B7\u30FC\u30C8
@ -1407,7 +1407,7 @@ Rename=\u540D\u79F0\u306E\u5909\u66F4
Widget-Load_By_Async=\u975E\u540C\u671F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9
Shape=\u56F3\u5F62
BindColumn-This_Condition_has_been_existed=\u5F53\u8A72\u6761\u4EF6\u306F\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:1305 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F
NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:11300005 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F
Set_Column_Title_Start=\u91CD\u8907\u3059\u308B\u6A19\u984C\u5217\u3092\u8A2D\u5B9A
Fri=\u91D1
M_Report-Report_Parameter=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC

4
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -1040,7 +1040,7 @@ FR-Designer-Tree_Width=\uB108\uBE44
Record=\uB808\uCF54\uB4DC
Poly-Report_Component=\uCDE8\uD569\uBB38\uC11C\uC5B4\uC148\uBE14\uB9AC
Options=\uC635\uC158
NS-war-remote=\uC624\uB958\uCF54\uB4DC\:1117 \uC555\uCD95\uC124\uCE58\uB97C\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. \uC6D0\uACA9\uB514\uC790\uC778
NS-war-remote=\uC624\uB958\uCF54\uB4DC\:11100017 \uC555\uCD95\uC124\uCE58\uB97C\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. \uC6D0\uACA9\uB514\uC790\uC778
Sche-Minute=\uBD84
Three_Rows_Of_Three_Grid=3\uD589 3\uC5F4\uC758\uADF8\uB9AC\uB4DC
WorkSheet=\uC790\uC720\uBB38\uC11C
@ -1408,7 +1408,7 @@ Rename=\uB9AC\uB124\uC784
Widget-Load_By_Async=\uBE44\uB3D9\uAE30\uB85C\uB529
Shape=\uADF8\uB798\uD504
BindColumn-This_Condition_has_been_existed=\uC774\uC870\uAC74\uC740\uC774\uBBF8\uC874\uC7AC\uD569\uB2C8\uB2E4.
NS-exception_readError=\uC624\uB958\uCF54\uB4DC\:1305 \uD15C\uD50C\uB9BF\uD30C\uC77C\uD574\uC11D\uC624\uB958
NS-exception_readError=\uC624\uB958\uCF54\uB4DC\:11300005 \uD15C\uD50C\uB9BF\uD30C\uC77C\uD574\uC11D\uC624\uB958
Set_Column_Title_Start=\uC911\uBCF5\uC81C\uBAA9\uC5F4\uC124\uC815
Fri=5
M_Report-Report_Parameter=\uD15C\uD50C\uB9BF\uB9E4\uAC1C\uBCC0\uC218

4
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -1039,7 +1039,7 @@ FR-Designer-Tree_Width=\u5BBD\u5EA6
Record=\u8BB0\u5F55
Poly-Report_Component=\u805A\u5408\u62A5\u8868\u7EC4\u4EF6
Options=\u9009\u9879
NS-war-remote=\u9519\u8BEF\u4EE3\u7801\:1117 \u538B\u7F29\u90E8\u7F72\u4E0D\u652F\u6301\u8FDC\u7A0B\u8BBE\u8BA1
NS-war-remote=\u9519\u8BEF\u4EE3\u7801\:11100017 \u538B\u7F29\u90E8\u7F72\u4E0D\u652F\u6301\u8FDC\u7A0B\u8BBE\u8BA1
Sche-Minute=\u5206
Three_Rows_Of_Three_Grid=\u4E09\u884C\u4E09\u5217\u7684\u683C\u5B50
WorkSheet=\u81EA\u7531\u62A5\u8868
@ -1407,7 +1407,7 @@ Rename=\u91CD\u547D\u540D
Widget-Load_By_Async=\u5F02\u6B65\u52A0\u8F7D
Shape=\u56FE\u5F62
BindColumn-This_Condition_has_been_existed=\u6B64\u6761\u4EF6\u5DF2\u7ECF\u5B58\u5728
NS-exception_readError=\u9519\u8BEF\u4EE3\u7801\:1305 \u6A21\u677F\u6587\u4EF6\u89E3\u6790\u51FA\u9519
NS-exception_readError=\u9519\u8BEF\u4EE3\u7801\:11300005 \u6A21\u677F\u6587\u4EF6\u89E3\u6790\u51FA\u9519
Set_Column_Title_Start=\u8BBE\u7F6E\u91CD\u590D\u6807\u9898\u5217
Fri=\u4E94
M_Report-Report_Parameter=\u6A21\u677F\u53C2\u6570

4
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -1039,7 +1039,7 @@ FR-Designer-Tree_Width=\u5BEC\u5EA6
Record=\u8A18\u9304
Poly-Report_Component=\u8907\u5408\u5F0F\u5831\u8868\u5143\u4EF6
Options=\u9078\u9805
NS-war-remote=\u932F\u8AA4\u4EE3\u78BC\:1117 \u58D3\u7E2E\u90E8\u7F72\u4E0D\u652F\u6301\u9060\u7A0B\u8A2D\u8A08
NS-war-remote=\u932F\u8AA4\u4EE3\u78BC\:11100017 \u58D3\u7E2E\u90E8\u7F72\u4E0D\u652F\u6301\u9060\u7A0B\u8A2D\u8A08
Sche-Minute=\u5206
Three_Rows_Of_Three_Grid=\u4E09\u5217\u4E09\u6B04\u7684\u683C\u5B50
WorkSheet=\u81EA\u7531\u5831\u8868
@ -1407,7 +1407,7 @@ Rename=\u91CD\u547D\u540D
Widget-Load_By_Async=\u975E\u540C\u6B65\u8F09\u5165
Shape=\u5716\u5F62
BindColumn-This_Condition_has_been_existed=\u6B64\u689D\u4EF6\u5DF2\u7D93\u5B58\u5728
NS-exception_readError=\u932F\u8AA4\u4EE3\u78BC\:1305 \u6A21\u677F\u6A94\u6848\u89E3\u6790\u51FA\u932F
NS-exception_readError=\u932F\u8AA4\u4EE3\u78BC\:11300005 \u6A21\u677F\u6A94\u6848\u89E3\u6790\u51FA\u932F
Set_Column_Title_Start=\u8A2D\u5B9A\u91CD\u8907\u6A19\u984C\u6B04
Fri=\u4E94
M_Report-Report_Parameter=\u6A21\u677F\u53C3\u6578

19
designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java

@ -26,6 +26,7 @@ import com.fr.general.ComparatorUtils;
public class WidgetPropertyTable extends AbstractPropertyTable {
private FormDesigner designer;
private static final int LEFT_COLUMN_WIDTH = 97; // "属性名"列的宽度
public WidgetPropertyTable(FormDesigner designer) {
super();
@ -86,10 +87,19 @@ public class WidgetPropertyTable extends AbstractPropertyTable {
setModel(model);
this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
TableColumn tc = this.getColumn(this.getColumnName(0));
tc.setPreferredWidth(30);
tc.setMinWidth(LEFT_COLUMN_WIDTH);
tc.setMaxWidth(LEFT_COLUMN_WIDTH);
this.repaint();
}
private void setRightColumnWidth(boolean automode) {
int rightColumnWidth = this.getWidth() - LEFT_COLUMN_WIDTH;
TableColumn tcRight = this.getColumn(this.getColumnName(1));
tcRight.setMinWidth(automode ? 0 : rightColumnWidth);
tcRight.setMaxWidth(automode ? this.getWidth() : rightColumnWidth);
}
private void setDesigner(FormDesigner designer) {
this.designer = designer;
}
@ -111,6 +121,13 @@ public class WidgetPropertyTable extends AbstractPropertyTable {
return null;
}
@Override
public void columnMarginChanged(javax.swing.event.ChangeEvent e) {
setRightColumnWidth(false);
super.columnMarginChanged(e);
setRightColumnWidth(true);
}
/**
* 待说明
*/

Loading…
Cancel
Save