Browse Source

格式化JavaScript代码+登录接口

master
RichieJi 7 years ago
parent
commit
3ee3f35bff
  1. BIN
      designer_base/src/com/fr/design/images/edit/format.png
  2. 49
      designer_base/src/com/fr/design/javascript/JSContentPane.java
  3. 1
      designer_base/src/com/fr/design/locale/designer.properties
  4. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  5. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  6. 1
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  7. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  8. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties

BIN
designer_base/src/com/fr/design/images/edit/format.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

49
designer_base/src/com/fr/design/javascript/JSContentPane.java

@ -1,17 +1,27 @@
package com.fr.design.javascript; package com.fr.design.javascript;
import com.fr.design.constants.KeyWords;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.autocomplete.*; import com.fr.design.constants.KeyWords;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.autocomplete.AutoCompletion;
import com.fr.design.gui.autocomplete.BasicCompletion;
import com.fr.design.gui.autocomplete.CompletionProvider;
import com.fr.design.gui.autocomplete.DefaultCompletionProvider;
import com.fr.design.gui.autocomplete.ShorthandCompletion;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.javascript.beautify.JavaScriptFormatHelper;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
public class JSContentPane extends BasicPane { public class JSContentPane extends BasicPane {
@ -24,7 +34,36 @@ public class JSContentPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
funNameLabel = new UILabel(); funNameLabel = new UILabel();
this.setFunctionTitle(args); this.setFunctionTitle(args);
this.add(funNameLabel, BorderLayout.NORTH);
UILabel label = new UILabel(Inter.getLocText("FR-Designer_Format_JavaScript"), IOUtils.readIcon("com/fr/design/images/edit/format.png"), SwingConstants.LEFT);
label.setCursor(new Cursor(Cursor.HAND_CURSOR));
label.setToolTipText(Inter.getLocText("FR-Designer_Format_JavaScript"));
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
new SwingWorker<String, Void>() {
@Override
protected String doInBackground() throws Exception {
return JavaScriptFormatHelper.beautify(contentTextArea.getText());
}
@Override
protected void done() {
try {
String text = get();
contentTextArea.setText(text);
} catch (Exception ignore) {
}
}
}.execute();
}
});
this.add(GUICoreUtils.createBorderLayoutPane(
funNameLabel, BorderLayout.WEST,
label, BorderLayout.EAST
), BorderLayout.NORTH);
contentTextArea = new RSyntaxTextArea(); contentTextArea = new RSyntaxTextArea();
contentTextArea.setCloseCurlyBraces(true); contentTextArea.setCloseCurlyBraces(true);
@ -84,7 +123,7 @@ public class JSContentPane extends BasicPane {
for (String s : args) { for (String s : args) {
list.add(s); list.add(s);
} }
titles = (String[])list.toArray(new String[list.size()]); titles = (String[]) list.toArray(new String[list.size()]);
} }
setFunctionTitle(titles); setFunctionTitle(titles);
} }

1
designer_base/src/com/fr/design/locale/designer.properties

@ -2148,3 +2148,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All= FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect. FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.
FR-Designer_Format_JavaScript=Format Code

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

@ -2147,3 +2147,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All= FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect. FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.
FR-Designer_Format_JavaScript=Format Code

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

@ -2148,3 +2148,4 @@ FR-Designer_Provide_Choose_All=\u5168\u9078\u629E\u53EF\u80FD
FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570: FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570:
FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9 FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9
FR-Designer_Env_Des_Https= FR-Designer_Env_Des_Https=
FR-Designer_Format_JavaScript=Format Code

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

@ -2148,3 +2148,4 @@ FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C
FR-Designer_Export_Background= FR-Designer_Export_Background=
FR-Designer_Print_Background= FR-Designer_Print_Background=
FR-Designer_Env_Des_Https= FR-Designer_Env_Des_Https=
FR-Designer_Format_JavaScript=Format Code

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

@ -2148,3 +2148,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All= FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u542F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8BC1\u4E66\u8DEF\u5F84\u3001https\u79D8\u94A5\uFF09\uFF0C\u5FC5\u987B\u91CD\u542F\u8BBE\u8BA1\u5668\u624D\u80FD\u751F\u6548\u3002 FR-Designer_Env_Des_Https=\u82E5\u542F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8BC1\u4E66\u8DEF\u5F84\u3001https\u79D8\u94A5\uFF09\uFF0C\u5FC5\u987B\u91CD\u542F\u8BBE\u8BA1\u5668\u624D\u80FD\u751F\u6548\u3002
FR-Designer_Format_JavaScript=\u683C\u5F0F\u5316\u4EE3\u7801

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

@ -2147,3 +2147,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All= FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u555F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8B49\u66F8\u8DEF\u5F91\u3001https\u7955\u9470\uFF09\uFF0C\u5FC5\u9808\u91CD\u555F\u8A2D\u8A08\u5668\u624D\u80FD\u751F\u6548\u3002 FR-Designer_Env_Des_Https=\u82E5\u555F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8B49\u66F8\u8DEF\u5F91\u3001https\u7955\u9470\uFF09\uFF0C\u5FC5\u9808\u91CD\u555F\u8A2D\u8A08\u5668\u624D\u80FD\u751F\u6548\u3002
FR-Designer_Format_JavaScript=Format Code

Loading…
Cancel
Save