Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
xiqiu 3 years ago
parent
commit
f4b79def59
  1. 12
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  2. 128
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  3. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java
  5. 10
      designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg
  6. 1
      designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json
  7. 8
      designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg
  8. 2
      designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json

12
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);

128
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);
//搜索按钮

3
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -206,7 +206,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
});
}
public UIButton createSaveButton() {
public UIButton createSaveButton(final TemplateThemeProfileDialog<T> profileDialog) {
saveButton = new UIButton();
saveButton.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save"));
saveButton.setEnabled(false);
@ -224,6 +224,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override
public void run() {
DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_Successfully"));
profileDialog.exit();
}
});
}

2
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java

@ -90,7 +90,7 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
}));
}
uiButtonList.add(profilePane.createSaveButton());
uiButtonList.add(profilePane.createSaveButton(TemplateThemeProfileDialog.this));
uiButtonList.add(profilePane.createSaveAsButton(TemplateThemeProfileDialog.this));
uiButtonList.add(createCancelButton());

10
designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="15px" height="15px" viewBox="0 0 15 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>高级编辑</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="高级编辑" fill-rule="nonzero">
<path d="M13.8797,5.91875 C13.5781,5.91875 13.3328,6.16406 13.3328,6.46562 L13.3328,10.6375 L3.87502,10.6375 L3.87502,2.17188 L7.23596,2.17188 C7.53752,2.17188 7.78284,1.92656 7.78284,1.625 C7.78284,1.32344 7.53752,1.07812 7.23596,1.07812 L3.32815,1.07812 C3.02659,1.07812 2.78127,1.32344 2.78127,1.625 L2.78127,3.73594 L1.50159,3.73594 C1.20002,3.73594 0.954712,3.98125 0.954712,4.28281 L0.954712,13.5031 C0.954712,13.8047 1.20002,14.05 1.50159,14.05 L12.0547,14.05 C12.3563,14.05 12.6016,13.8047 12.6016,13.5031 L12.6016,11.7312 L13.8813,11.7312 C14.1828,11.7312 14.4282,11.4859 14.4282,11.1844 L14.4282,6.46562 C14.4266,6.16406 14.1813,5.91875 13.8797,5.91875 Z M11.5063,12.9578 L2.04846,12.9578 L2.04846,4.83125 L2.78127,4.83125 L2.78127,11.1844 C2.78127,11.4859 3.02659,11.7312 3.32815,11.7312 L11.5063,11.7312 L11.5063,12.9578 Z" id="形状" fill="#333334"></path>
<path d="M6.35444,5.79122 C6.34516,5.80296 6.33589,5.81533 6.33172,5.83022 L5.61566,8.44127 C5.57391,8.59329 5.61668,8.7571 5.72983,8.87257 C5.81446,8.9548 5.92597,9 6.04474,9 C6.08396,9 6.12326,8.99533 6.16194,8.98511 L8.76858,8.27801 C8.77277,8.27801 8.77479,8.28165 8.77794,8.28165 C8.80789,8.28165 8.83731,8.27081 8.85952,8.24823 L14.2794,2.80158 C14.4864,2.59539 14.6,2.31452 14.6,2.00894 C14.6,1.66268 14.4523,1.31656 14.1937,1.06006 L13.5355,0.40431 C13.2773,0.14713 12.9288,0 12.5808,0 C12.2736,0 11.9912,0.11295 11.7837,0.31861 L6.36482,5.76711 C6.35758,5.77373 6.35961,5.78352 6.35444,5.79122 Z M13.5974,2.12274 L12.905,2.81081 L11.7827,1.67681 L12.4652,0.99796 C12.573,0.89011 12.7822,0.90584 12.9061,1.02954 L13.5648,1.68529 C13.6335,1.75355 13.6727,1.84442 13.6727,1.93427 C13.6723,2.00792 13.6459,2.07475 13.5974,2.12274 Z M7.59405,5.90013 L11.0733,2.38229 L12.1962,3.51705 L8.72632,7.02506 L7.59405,5.90013 Z M6.67769,7.92832 L7.04115,6.60144 L8.01068,7.56581 L6.67769,7.92832 Z" id="形状" fill="#2F8EF1"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

1
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": {}
}
}

8
designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg

@ -0,0 +1,8 @@
<svg width="96" height="96" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M47.5858 80.0834L56.4953 71.1738C51.5747 66.2532 43.5968 66.2532 38.6762 71.1738L47.5858 80.0834Z" fill="#D6D6D9"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M72.3345 55.3345C58.6662 41.6661 36.5054 41.6661 22.837 55.3345L29.7667 62.2641C39.6079 52.4229 55.5637 52.4229 65.4049 62.2641L72.3345 55.3345Z" fill="#E5E5E7"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M87.1838 40.4854C65.3144 18.616 29.8572 18.616 7.98779 40.4854L14.9174 47.415C32.9597 29.3728 62.2119 29.3728 80.2541 47.415L87.1838 40.4854Z" fill="#E8E8E8"/>
<circle cx="68.5" cy="66.5" r="17.5" fill="#F5F5F7"/>
<circle cx="68.5" cy="66.5" r="14.5" fill="#D6D6D9"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M74.5104 62.6107C75.0962 62.0249 75.0962 61.0752 74.5104 60.4894C73.9246 59.9036 72.9749 59.9036 72.3891 60.4894L68.5 64.3785L64.6109 60.4894C64.0251 59.9036 63.0754 59.9036 62.4896 60.4894C61.9038 61.0752 61.9038 62.0249 62.4896 62.6107L66.3787 66.4998L62.4896 70.3889C61.9038 70.9747 61.9038 71.9244 62.4896 72.5102C63.0754 73.096 64.0251 73.096 64.6109 72.5102L68.5 68.6211L72.3891 72.5102C72.9749 73.096 73.9246 73.096 74.5104 72.5102C75.0962 71.9244 75.0962 70.9747 74.5104 70.3889L70.6213 66.4998L74.5104 62.6107Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

2
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"]
}
Loading…
Cancel
Save