Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~ju/design into feature/10.0

research/10.0
ju 6 years ago
parent
commit
4fd2434ae2
  1. 12
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 11
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 32
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  5. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
  6. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
  7. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  8. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  9. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  10. 18
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  11. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  12. 15
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  13. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java

12
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -184,9 +184,9 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/
public int contains(String filename) {
for (int i = 0; i < historyList.size(); i++) {
String historyPath = historyList.get(i).getPath().replaceAll("/", "\\\\");
//文件路径是全路径,历史路径是reportlets/模板名
if (filename.endsWith(historyPath)) {
String historyPath = historyList.get(i).getPath();
//文件路径和历史路径都是 reportlets/xxx/xxx/xxx/xx.suffix
if (filename.equals(historyPath)) {
return i;
}
}
@ -233,16 +233,16 @@ public class HistoryTemplateListCache implements CallbackEvent {
public void deleteFile(FileNodeFILE file) {
boolean isDir = file.isDirectory();
String suffix = isDir ? "\\" : StringUtils.EMPTY;
String suffix = isDir ? CoreConstants.SEPARATOR : StringUtils.EMPTY;
// path like reportlets/xx/xxx/xxx
String path = file.getPath().replaceAll("/", "\\\\") + suffix;
String path = file.getPath() + suffix;
ListIterator<JTemplate<?, ?>> iterator = historyList.listIterator();
while (iterator.hasNext()) {
JTemplate<?, ?> template = iterator.next();
String tPath = template.getPath().replaceAll("/", "\\\\");
String tPath = template.getPath();
if (isDir ? tPath.startsWith(path) : tPath.equals(path)) {
iterator.remove();
int index = iterator.nextIndex();

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

@ -13,12 +13,10 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.ProductConstants;
import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
@ -54,7 +52,6 @@ import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D;
import java.io.File;
import java.util.List;
/**
@ -679,12 +676,10 @@ public class MutilTempalteTabPane extends JComponent {
}
//当前激活的模板
String filename = openedTemplate.get(selectedIndex).getEditingFILE().getPath();
if (filename.startsWith(ProjectConstants.REPORTLETS_NAME)) {
filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename;
}
String filename = openedTemplate.get(selectedIndex).getPath();
filename = FilenameUtils.normalize(filename);
filename = FilenameUtils.standard(filename);
if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) {
specifiedTemplate.stopEditing();

2
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -757,7 +757,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) {
path = workspace.getPath() + File.separator + path;
}
defaultTitleSB.append(" " + path);
defaultTitleSB.append(" ").append(path);
}
setTitle(defaultTitleSB.toString());

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

@ -143,7 +143,15 @@ public class AlphaFineDialog extends UIDialog {
private static String beforeSearchStr = "";
private static boolean alreadySearch = false;
private static boolean alreadyInitHot = false;
public static String[][] data;
private String[][] hotData;
public String[][] getHotData() {
return hotData;
}
public void setHotData(String[][] hotData) {
this.hotData = hotData;
}
public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent);
@ -242,14 +250,14 @@ public class AlphaFineDialog extends UIDialog {
try {
HttpGet getHelp = new HttpGet(AlphaFineConstants.ALPHA_HOT_SEARCH);
HttpToolbox.getHttpClient(AlphaFineConstants.ALPHA_HOT_SEARCH).execute(getHelp).getStatusLine();
if (data == null) {
data = HotIssuesManager.getInstance().getHotIssues();
if (hotData == null) {
hotData = HotIssuesManager.getInstance().getHotIssues();
}
for (int i = 0; i < data.length; i++) {
panel.add(new HotIssueJpanel(data[i], i + 1));
for (int i = 0; i < hotData.length; i++) {
panel.add(new HotIssueJpanel(hotData[i], i + 1));
}
} catch (Exception e) {
data = null;
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));
}
@ -544,7 +552,7 @@ public class AlphaFineDialog extends UIDialog {
}
private void buildDocumentList(final String[] searchText) {
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText));
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildFileList(String searchStr, final String[] searchText) {
@ -552,24 +560,24 @@ public class AlphaFineDialog extends UIDialog {
}
private void buildActionList(final String[] searchText) {
addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText));
addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildPluginList(final String[] searchText) {
addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText));
addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildRecommendList(final String[] searchText) {
addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText));
addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildRecentList(final String[] searchText) {
addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText));
addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildSimilarList(final String[] searchText) {
addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(searchText));
addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(getHotData(), searchText));
}
private synchronized void addSearchResult(SearchResult searchResult) {

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

@ -28,6 +28,8 @@ import java.net.URL;
*/
public class RobotPreviewPane extends JPanel {
private static final int TITLE_AREA_HEIGHT = 30;
public RobotPreviewPane(String title, String content) {
this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE);
@ -41,17 +43,17 @@ public class RobotPreviewPane extends JPanel {
final JEditorPane editorPane = new JEditorPane();
editorPane.setEditorKit(new HTMLEditorKit());
editorPane.setText(content+"<br><br><br>");
editorPane.setText(content + "<br><br><br>");
editorPane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
return;
}
if(e.getDescription().startsWith(AlphaFineConstants.JAVASCRIPT_PREFIX)){
String s = e.getDescription().replaceAll(AlphaFineConstants.JAVASCRIPT_PREFIX,StringUtils.EMPTY)
.replaceAll("\\('",StringUtils.EMPTY)
.replaceAll("'\\)",StringUtils.EMPTY);
if (e.getDescription().startsWith(AlphaFineConstants.JAVASCRIPT_PREFIX)) {
String s = e.getDescription().replaceAll(AlphaFineConstants.JAVASCRIPT_PREFIX, StringUtils.EMPTY)
.replaceAll("\\('", StringUtils.EMPTY)
.replaceAll("'\\)", StringUtils.EMPTY);
try {
Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + s));
} catch (IOException e1) {
@ -60,7 +62,8 @@ public class RobotPreviewPane extends JPanel {
FineLoggerFactory.getLogger().error(e1.getMessage());
}
}
URL linkUrl = e.getURL();if (linkUrl != null) {
URL linkUrl = e.getURL();
if (linkUrl != null) {
try {
Desktop.getDesktop().browse(e.getURL().toURI());
} catch (IOException | URISyntaxException e1) {
@ -73,6 +76,7 @@ public class RobotPreviewPane extends JPanel {
UIScrollPane jScrollPane = new UIScrollPane(editorPane);
jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white));
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[] searchText);
SearchResult getLessSearchResult(String[][] data, String[] searchText);
/**
* 获取剩余条数

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

@ -12,10 +12,9 @@ import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvi
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.mainframe.toolbar.UpdateActionModel;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import java.util.List;
@ -58,15 +57,15 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[] searchText) {
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
filterModelList = new SearchResult();
lessModelList = new SearchResult();
moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) {
if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set")));
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) {
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) {
for (int j = 0; j < searchText.length; j++) {

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

@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
@ -52,19 +51,16 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[] searchText) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if (AlphaFineDialog.data == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
public SearchResult getLessSearchResult(String[][] hotData, 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);
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
SearchResult searchResult = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText[j] + AlphaFineConstants.FIRST_PAGE;
@ -78,7 +74,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i));
if (!AlphaFineHelper.getFilterResult().contains(cellModel)) {
if (!AlphaFineHelper.getFilterResult().contains(cellModel) && !searchResult.contains(cellModel)) {
searchResult.add(cellModel);
}
}

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[] searchText) {
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
return null;
}

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

@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.ComparatorUtils;
@ -17,8 +16,8 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ -97,20 +96,17 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[] searchText) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if (AlphaFineDialog.data == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
SearchResult searchResult = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
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 searchResult = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
for (int j = 0; j < searchText.length; j++) {
try {
String encodedKey = URLEncoder.encode(searchText[j], EncodeConstants.ENCODING_UTF_8);
@ -123,7 +119,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
if (cellModel != null && !AlphaFineHelper.getFilterResult().contains(cellModel)) {
if (cellModel != null && !AlphaFineHelper.getFilterResult().contains(cellModel) && !searchResult.contains(cellModel)) {
searchResult.add(cellModel);
}
}

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[] searchText) {
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
this.modelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
recentModelList = getRecentModelList(searchText[j]);

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

@ -8,7 +8,6 @@ import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
@ -16,9 +15,9 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.ArrayUtils;
import java.io.IOException;
import java.util.Iterator;
@ -47,15 +46,15 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[] searchText) {
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
this.modelList = new SearchResult();
this.recommendModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if(AlphaFineDialog.data == null){
} else if(hotData == null){
return AlphaFineHelper.getNoConnectList(instance);
}
this.modelList = new SearchResult();
this.recommendModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
for (int j = 0; j < searchText.length; j++) {
searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY);
try {
@ -69,7 +68,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i));
if (alphaCellModel != null && !alreadyContain(alphaCellModel)) {
if (alphaCellModel != null && !alreadyContain(alphaCellModel) && !this.recommendModelList.contains(alphaCellModel)) {
this.recommendModelList.add(alphaCellModel);
}
}

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

@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
@ -38,14 +37,14 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
}
@Override
public SearchResult getLessSearchResult(String[] searchText) {
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
lessModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if (AlphaFineDialog.data == null) {
} else if (hotData == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
lessModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
SearchResult allModelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]);

Loading…
Cancel
Save