diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
index 10bee69d27..65bec03a84 100644
--- a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
+++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
@@ -1,5 +1,6 @@
package com.fr.design.javascript;
+import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.KeyWords;
@@ -16,6 +17,7 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
+import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.beautify.JavaScriptFormatHelper;
import com.fr.design.javascript.jsapi.JSImplPopulateAction;
import com.fr.design.javascript.jsapi.JSImplUpdateAction;
@@ -92,7 +94,7 @@ public class JSContentPane extends BasicPane {
private void addNewPaneLabel(){
- UILabel advancedEditorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Advanced_Editor"), SwingConstants.LEFT);
+ UILabel advancedEditorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Advanced_Editor"), IconUtils.readIcon("com/fr/design/images/edit/advancedEditor.svg"), SwingConstants.LEFT);
advancedEditorLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
advancedEditorLabel.addMouseListener(new MouseAdapter() {
@@ -104,7 +106,7 @@ public class JSContentPane extends BasicPane {
jsImplUpdateAction.update(javaScript);
newJavaScriptImplPane.populate(javaScript);
if(advancedEditorDialog == null || !advancedEditorDialog.isVisible()) {
- advancedEditorDialog = newJavaScriptImplPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
+ advancedEditorDialog = newJavaScriptImplPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
if (javaScript != null) {
@@ -117,7 +119,7 @@ public class JSContentPane extends BasicPane {
public void doCancel() {
super.doCancel();
}
- });
+ },new Dimension(900,800));
advancedEditorDialog.setModal(modal);
advancedEditorDialog.setResizable(true);
advancedEditorDialog.pack();
@@ -126,7 +128,7 @@ public class JSContentPane extends BasicPane {
advancedEditorDialog.requestFocus();
}
});
- labelPane.add(advancedEditorLabel,BorderLayout.CENTER);
+ labelPane.add(advancedEditorLabel,BorderLayout.EAST);
}
protected UIScrollPane createContentTextAreaPanel(){
@@ -181,7 +183,7 @@ public class JSContentPane extends BasicPane {
}
});
- labelPane.add(label,BorderLayout.EAST);
+ labelPane.add(label,BorderLayout.CENTER);
JPanel jsParaPane = new JPanel(new BorderLayout(4, 4));
jsParaPane.setPreferredSize(new Dimension(300, 80));
UIScrollPane scrollPane = new UIScrollPane(funNameLabel);
diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
index b1516fe366..ffbfa8425e 100644
--- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
+++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
@@ -1,5 +1,6 @@
package com.fr.design.javascript;
+import com.fr.base.svg.IconUtils;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.autocomplete.AutoCompleteExtraRefreshComponent;
@@ -12,7 +13,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
-import com.fr.design.gui.itextfield.UITextField;
+import com.fr.design.gui.itextfield.PlaceholderTextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.jsapi.JSAPITreeHelper;
import com.fr.design.javascript.jsapi.JSAPIUserObject;
@@ -26,8 +27,10 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
+import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
@@ -69,7 +72,7 @@ import javax.swing.tree.TreePath;
public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener {
//搜索关键词输入框
- private UITextField keyWordTextField = new UITextField(16);
+ private PlaceholderTextField keyWordTextField = new PlaceholderTextField(16);
//搜索出的提示列表
private JList tipsList;
private DefaultListModel tipsListModel = new DefaultListModel();
@@ -109,6 +112,11 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private String currentValue;
+ private static CardLayout card;
+
+ private static final String RELOAD_CARD = "reloadCard";
+ private static final String DOC_LIST_CARD = "docListCard";
+
public JSContentWithDescriptionPane(String[] args) {
this.setLayout(new BorderLayout());
//===============================
@@ -156,6 +164,14 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
this.add(functionNameAndDescriptionPanel, BorderLayout.SOUTH);
}
+ public void populate(String js) {
+ contentTextArea.setText(js);
+ ifHasBeenWriten = 1;
+ currentPosition = contentTextArea.getCaretPosition();
+ beginPosition = getBeginPosition();
+ insertPosition = beginPosition;
+ }
+
private void initContextAreaListener() {
contentTextArea.addKeyListener(new KeyAdapter() {
@Override
@@ -186,6 +202,27 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
uninstallAutoCompletion();
}
});
+ contentTextArea.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mousePressed(MouseEvent e) {
+ insertPosition = contentTextArea.getCaretPosition();
+ if (ifHasBeenWriten == 0) {
+ contentTextArea.setText(StringUtils.EMPTY);
+ ifHasBeenWriten = 1;
+ contentTextArea.setForeground(Color.black);
+ insertPosition = 0;
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ currentPosition = contentTextArea.getCaretPosition();
+ if (currentPosition == insertPosition) {
+ beginPosition = getBeginPosition();
+ insertPosition = beginPosition;
+ }
+ }
+ });
}
@Override
@@ -281,9 +318,9 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
String value = ((JSAPIUserObject) userObject).getValue();
if (StringUtils.equals(value, directCategory)) {
moduleTree.setSelectionPath(new TreePath(treeModel.getPathToRoot(node)));
+ moduleTree.scrollPathToVisible(moduleTree.getSelectionPath());
return true;
}
- return false;
}
for (int i = 0; i < node.getChildCount(); i++) {
if (setModuleTreeSelection(node.getChildAt(i), directCategory, treeModel)) {
@@ -340,39 +377,60 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
}
private void initHelpDocumentPane(JPanel descriptionAndDocumentPanel) {
- UIScrollPane helpDOCScrollPane;
+ card = new CardLayout();
+ JPanel mainPane = new JPanel(card);
+ initHelpDocumentList();
+ UIScrollPane helpDOCScrollPane = new UIScrollPane(helpDOCList);
+ helpDOCScrollPane.setPreferredSize(new Dimension(200, 200));
+ helpDOCScrollPane.setBorder(null);
+ mainPane.add(helpDOCScrollPane, DOC_LIST_CARD);
+
+ UILabel imageLabel = new UILabel();
+ imageLabel.setIcon(IconUtils.readIcon("com/fr/design/javascript/jsapi/images/connectFailed.svg"));
+ imageLabel.setPreferredSize(new Dimension(180, 65));
+ JPanel imagePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ imagePane.setBorder(BorderFactory.createEmptyBorder(0, 42, 0, 0));
+ imagePane.add(imageLabel);
+ imagePane.setBackground(Color.WHITE);
+
+ UILabel failedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Net_Connect_Failed"), 0);
+ failedLabel.setPreferredSize(new Dimension(180, 20));
+ UILabel reloadLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reload"), 0);
+ reloadLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ reloadLabel.setPreferredSize(new Dimension(180, 20));
+ reloadLabel.setForeground(Color.blue);
+ JPanel labelPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0);
+
+ labelPane.setBorder(BorderFactory.createEmptyBorder(35, 45, 0, 0));
+ labelPane.setBackground(Color.WHITE);
+ labelPane.add(imagePane);
+ labelPane.add(failedLabel);
+ labelPane.add(reloadLabel);
+ JPanel containerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ containerPanel.add(labelPane, BorderLayout.CENTER);
+ reloadLabel.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (isNetworkOk()) {
+ doHelpDocumentSearch();
+ card.show(mainPane, DOC_LIST_CARD);
+ }
+ }
+ });
+ mainPane.add(containerPanel, RELOAD_CARD);
if (isNetworkOk()) {
- helpDOCList = new JList(new DefaultListModel());
- initHelpDOCListRender();
- initHelpDOCListListener();
- helpDOCScrollPane = new UIScrollPane(helpDOCList);
doHelpDocumentSearch();
+ card.show(mainPane, DOC_LIST_CARD);
} else {
- UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Net_Connect_Failed"), 0);
- label1.setPreferredSize(new Dimension(180, 20));
- UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reload"), 0);
- label2.setPreferredSize(new Dimension(180, 20));
- label2.setForeground(Color.blue);
- JPanel labelPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0);
- labelPane.setBackground(Color.WHITE);
- labelPane.add(label1);
- labelPane.add(label2);
- JPanel containerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
- containerPanel.add(labelPane, BorderLayout.CENTER);
- helpDOCScrollPane = new UIScrollPane(containerPanel);
- label2.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- descriptionAndDocumentPanel.removeAll();
- initHelpDocumentPane(descriptionAndDocumentPanel);
-
- }
- });
+ card.show(mainPane, RELOAD_CARD);
}
- helpDOCScrollPane.setPreferredSize(new Dimension(200, 200));
- helpDOCScrollPane.setBorder(null);
- descriptionAndDocumentPanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Relevant_Cases"), helpDOCScrollPane), BorderLayout.EAST);
+ descriptionAndDocumentPanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Relevant_Cases"), mainPane), BorderLayout.EAST);
+ }
+ private void initHelpDocumentList() {
+ helpDOCList = new JList(new DefaultListModel());
+ initHelpDOCListRender();
+ initHelpDOCListListener();
}
private void initHelpDOCListListener() {
@@ -558,7 +616,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
}
private void initInterfaceNameModule() {
- moduleTree.setSelectionPath(moduleTree.getPathForRow(0));
+ DefaultTreeModel defaultTreeModel = (DefaultTreeModel) moduleTree.getModel();
+ TreeNode root = (TreeNode) defaultTreeModel.getRoot();
+ while (root.getChildCount() > 0){
+ root = root.getChildAt(0);
+ }
+ moduleTree.setSelectionPath(new TreePath(defaultTreeModel.getPathToRoot(root)));
}
private void setDescription(String interfaceName) {
@@ -652,6 +715,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
tipsPane.setBorder(BorderFactory.createEmptyBorder(30, 2, 0, 0));
JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
searchPane.setLayout(new BorderLayout(4, 4));
+ keyWordTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Search_Interface"));
searchPane.add(keyWordTextField, BorderLayout.CENTER);
//搜索按钮
diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg b/designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg
new file mode 100644
index 0000000000..6ddc105cb9
--- /dev/null
+++ b/designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json
index ad17929765..ece3628ab5 100644
--- a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json
+++ b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json
@@ -41,7 +41,6 @@
},
"Fine-Design_JSAPI_Form": {
"Fine-Design_JSAPI_Form_Component_Get": {},
- "Fine-Design_JSAPI_Form_Component_Universal": {},
"Fine-Design_JSAPI_Form_Component_Tab": {}
}
}
\ No newline at end of file
diff --git a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg
new file mode 100644
index 0000000000..6b0dfbc665
--- /dev/null
+++ b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg
@@ -0,0 +1,8 @@
+
diff --git a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json
index e268f70e18..dcad373927 100644
--- a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json
+++ b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json
@@ -29,5 +29,5 @@
"importExcel_Append", "importExcel_Cover", "stash", "clear"],
"Fine-Design_JSAPI_Cpt_View_Preview_Report_Location":["centerReport"],
"Fine-Design_JSAPI_Form_Component_Get":["getAllWidgets"],
- "Fine-Design_JSAPI_Form_Component_Tab":["showCardByIndex", "showCardByIndex", "getShowIndex", "setTitleVisible"]
+ "Fine-Design_JSAPI_Form_Component_Tab":["showCardByIndex", "getShowIndex", "setTitleVisible"]
}
\ No newline at end of file