Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~zheng/C-design into release/10.0

final/10.0
zheng 6 years ago
parent
commit
eadb2e7fb0
  1. 24
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  2. 11
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java
  3. 12
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  4. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal.png
  5. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal@2x.png
  6. 23
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  7. 23
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  8. 15
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
  9. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
  10. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  11. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  12. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  13. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  14. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  15. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  16. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java
  17. 5
      designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

24
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -17,6 +17,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.ProductConstants;
import com.fr.third.javax.annotation.Nonnull;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
@ -677,32 +678,29 @@ public class MutilTempalteTabPane extends JComponent {
//当前激活的模板
String filename = openedTemplate.get(selectedIndex).getPath();
filename = FilenameUtils.standard(filename);
if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) {
specifiedTemplate.stopEditing();
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?",
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
specifiedTemplate.saveTemplate();
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
activeTemplate(filename);
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
closeTpl(specifiedTemplate, filename);
} else if (returnVal == JOptionPane.NO_OPTION) {
closeTpl(specifiedTemplate, filename);
}
} else {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
closeTpl(specifiedTemplate, filename);
}
activeTemplate(filename);
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
}
private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate, @Nonnull String fileName) {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
activeTemplate(fileName);
}
/**

11
designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java

@ -253,23 +253,16 @@ public class AuthorityListControlPane extends BasicPane {
* @param authorities authority
*/
public void setAuthority(List<DesignAuthority> authorities) {
if (authorities == null || authorities.isEmpty()) {
return;
}
DefaultListModel<DesignAuthority> model = (DefaultListModel<DesignAuthority>) authorityList.getModel();
model.clear();
if (authorities != null && !authorities.isEmpty()) {
for (DesignAuthority authority : authorities) {
model.addElement(authority);
}
int size = model.getSize() - 1;
authorityList.setSelectedIndex(size);
authorityList.ensureIndexIsVisible(size);
}
authorityList.revalidate();
authorityList.repaint();
}

12
designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java

@ -1,5 +1,6 @@
package com.fr.design.remote.ui;
import com.fr.base.BaseUtils;
import com.fr.design.border.UITitledBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
@ -240,13 +241,14 @@ public class UserManagerPane extends BasicPane {
);
// 搜索
JPanel searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
searchPanel.setBorder(BorderFactory.createEmptyBorder());
keyField.setPreferredSize(new Dimension(250, 20));
JPanel searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5));
searchPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
keyField.setPreferredSize(new Dimension(270, 20));
keyField.requestFocus();
keyField.addKeyListener(keyFieldKeyListener);
keyField.getDocument().addDocumentListener(documentListener);
keyButton.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Search"));
keyButton.setIcon(BaseUtils.readIcon("com/fr/design/images/buttonicon/user_search_normal.png"));
keyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Search"));
keyButton.addActionListener(keyButtonActionListener);
searchPanel.add(keyField);
searchPanel.add(keyButton);
@ -367,9 +369,9 @@ public class UserManagerPane extends BasicPane {
final SwingWorker getMemberWorker = new SwingWorker<List<RemoteDesignMember>, Void>() {
@Override
protected List<RemoteDesignMember> doInBackground() {
addingMembers.clear();
String username = WorkContext.getCurrent().getConnection().getUserName();
synchronized (addingMembers) {
addingMembers.clear();
Collection<RemoteDesignMember> more = WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword);
pageNum = 1;
if (!more.isEmpty()) {

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

23
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -16,11 +16,15 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager
import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManeger;
import com.fr.general.ProcessCanceledException;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.stable.StringUtils;
import com.fr.third.org.apache.http.HttpStatus;
import com.fr.third.org.apache.http.StatusLine;
import com.fr.third.org.apache.http.client.methods.HttpGet;
import java.util.List;
@ -30,6 +34,7 @@ import java.util.List;
public class AlphaFineHelper {
public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed"));
private static AlphaFineDialog alphaFineDialog;
private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com";
/**
* 弹出alphafine搜索面板
@ -130,6 +135,9 @@ public class AlphaFineHelper {
* @return
*/
public static SearchResult getNoConnectList(Object object) {
if (isNetworkOk()){
return null;
}
SearchResult result = new SearchResult();
if (object instanceof RecommendSearchManager) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend")));
@ -145,4 +153,19 @@ public class AlphaFineHelper {
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
/**
* 判断网络是否异常
* @return
*/
public static boolean isNetworkOk(){
HttpGet getHelp = new HttpGet(URL_FOR_TEST_NETWORK);
try {
StatusLine statusLine = HttpToolbox.getHttpClient(URL_FOR_TEST_NETWORK).execute(getHelp).getStatusLine();
return statusLine.getStatusCode() == HttpStatus.SC_OK;
} catch (Exception ignore) {
// 网络异常
return false;
}
}
}

23
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -39,7 +39,6 @@ import com.fr.form.main.Form;
import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter;
import com.fr.json.JSONException;
@ -49,7 +48,6 @@ import com.fr.main.impl.WorkBook;
import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.http.client.methods.HttpGet;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
@ -247,22 +245,19 @@ public class AlphaFineDialog extends UIDialog {
GridLayout gridLayout = new GridLayout(2, 3, 3, 3);
JPanel panel = new JPanel();
panel.setLayout(gridLayout);
try {
HttpGet getHelp = new HttpGet(AlphaFineConstants.ALPHA_HOT_SEARCH);
HttpToolbox.getHttpClient(AlphaFineConstants.ALPHA_HOT_SEARCH).execute(getHelp).getStatusLine();
if(AlphaFineHelper.isNetworkOk()) {
if (hotData == null) {
hotData = HotIssuesManager.getInstance().getHotIssues();
}
for (int i = 0; i < hotData.length; i++) {
panel.add(new HotIssueJpanel(hotData[i], i + 1));
}
} catch (Exception e) {
}else {
hotData = null;
for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) {
panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1));
}
}
hotPane.add(uiLabel, BorderLayout.NORTH);
hotPane.add(panel, BorderLayout.CENTER);
add(hotPane, BorderLayout.SOUTH);
@ -552,7 +547,7 @@ public class AlphaFineDialog extends UIDialog {
}
private void buildDocumentList(final String[] searchText) {
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText));
}
private void buildFileList(String searchStr, final String[] searchText) {
@ -560,24 +555,24 @@ public class AlphaFineDialog extends UIDialog {
}
private void buildActionList(final String[] searchText) {
addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText));
}
private void buildPluginList(final String[] searchText) {
addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText));
}
private void buildRecommendList(final String[] searchText) {
addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText));
}
private void buildRecentList(final String[] searchText) {
addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText));
}
private void buildSimilarList(final String[] searchText) {
addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(getHotData(), searchText));
addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(searchText));
}
private synchronized void addSearchResult(SearchResult searchResult) {
@ -740,7 +735,7 @@ public class AlphaFineDialog extends UIDialog {
if (!isCancelled() && rightSearchResultPane != null) {
rightSearchResultPane.removeAll();
try {
rightSearchResultPane.add(new RobotPreviewPane((selectedValue).getName(), get()));
rightSearchResultPane.add(new RobotPreviewPane(selectedValue, get()));
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("get hot item content error: " + e.getMessage());
} catch (ExecutionException e) {

15
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java

@ -4,6 +4,8 @@ package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
@ -28,13 +30,14 @@ import java.net.URL;
*/
public class RobotPreviewPane extends JPanel {
private static final int TITLE_AREA_HEIGHT = 30;
private static final int TITLE_AREA_HEIGHT = 15;
private static final int HOT_TITLE_AREA_HEIGHT = 30;
public RobotPreviewPane(String title, String content) {
public RobotPreviewPane(AlphaCellModel model, String content) {
this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE);
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
UITextArea titleArea = new UITextArea(title);
UITextArea titleArea = new UITextArea(model.getName());
titleArea.setBorder(null);
titleArea.setEditable(false);
titleArea.setForeground(AlphaFineConstants.BLUE);
@ -74,9 +77,13 @@ public class RobotPreviewPane extends JPanel {
});
editorPane.setEditable(false);
UIScrollPane jScrollPane = new UIScrollPane(editorPane);
jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 30, 0));
jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white));
if (((RobotModel) model).isHotItemModel()) {
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - HOT_TITLE_AREA_HEIGHT));
} else {
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - TITLE_AREA_HEIGHT));
}
add(jScrollPane, BorderLayout.CENTER);
}
}

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java

@ -12,7 +12,7 @@ public interface AlphaFineSearchProvider {
* @param searchText
* @return
*/
SearchResult getLessSearchResult(String[][] data, String[] searchText);
SearchResult getLessSearchResult(String[] searchText);
/**
* 获取剩余条数

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java

@ -57,7 +57,7 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
public SearchResult getLessSearchResult(String[] searchText) {
filterModelList = new SearchResult();
lessModelList = new SearchResult();
moreModelList = new SearchResult();

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java

@ -51,15 +51,17 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
public SearchResult getLessSearchResult(String[] searchText) {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
return lessModelList;
} else if (hotData == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){
return noConnectList;
}
SearchResult searchResult = new SearchResult();
for (int j = 0; j < searchText.length; j++) {

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java

@ -96,7 +96,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
public SearchResult getLessSearchResult(String[] searchText) {
return null;
}

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

@ -96,7 +96,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
public SearchResult getLessSearchResult(String[] searchText) {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
SearchResult searchResult = new SearchResult();
@ -104,8 +104,10 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
return lessModelList;
} else if (hotData == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){
return noConnectList;
}
for (int j = 0; j < searchText.length; j++) {
try {

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java

@ -72,7 +72,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
public SearchResult getLessSearchResult(String[] searchText) {
this.modelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
recentModelList = getRecentModelList(searchText[j]);

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java

@ -46,14 +46,16 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
public SearchResult getLessSearchResult(String[] searchText) {
this.modelList = new SearchResult();
this.recommendModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if(hotData == null){
return AlphaFineHelper.getNoConnectList(instance);
}
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){
return noConnectList;
}
for (int j = 0; j < searchText.length; j++) {
searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY);

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java

@ -37,13 +37,15 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
public SearchResult getLessSearchResult(String[] searchText) {
lessModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if (hotData == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){
return noConnectList;
}
SearchResult allModelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) {

5
designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

@ -401,6 +401,9 @@ public class ImagePreLoader {
"com/fr/design/images/control/up.png",
"com/fr/design/images/control/down.png",
"com/fr/design/images/condition/bracket.png",
"com/fr/design/images/condition/unBracket.png"
"com/fr/design/images/condition/unBracket.png",
"com/fr/design/images/buttonicon/user_search_normal.png",
"com/fr/design/remote/images/icon_Member_normal@1x.png",
"/com/fr/design/images/buttonicon/add.png"
};
}

Loading…
Cancel
Save