Browse Source

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

final/10.0
plough 7 years ago
parent
commit
7f9ad664f0
  1. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/ObjectJControlPane.java
  3. 13
      designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPane.java
  4. 16
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  5. 67
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  6. 47
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  7. 30
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  8. 82
      designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java
  9. 186
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  10. 14
      designer-realize/src/main/java/com/fr/design/webattr/ReportWriteAttrPane.java

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -103,7 +103,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
private boolean isIncludeUnderline(String name) {
return ComparatorUtils.equals(name.indexOf(StoreProcedureAssist.GROUP_MARKER), -1) ? false : true;
return name.contains(StoreProcedureAssist.GROUP_MARKER);
}
/**

7
designer-base/src/main/java/com/fr/design/gui/controlpane/ObjectJControlPane.java

@ -23,7 +23,10 @@ public abstract class ObjectJControlPane extends JListControlPane {
@Override
protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
return Reflect.on(creator.getUpdatePane()).create(object).get();
try {
return Reflect.on(creator.getUpdatePane()).create(object).get();
} catch (Exception e) {
return super.createPaneByCreators(creator);
}
}
}

13
designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPane.java

@ -8,9 +8,13 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.LayoutUtils;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import javax.swing.*;
import java.awt.*;
/**
* @author richer
@ -23,6 +27,10 @@ public abstract class LoadingBasicPane extends BasicPane {
private JProgressBar progressBar;
public LoadingBasicPane() {
initCards();
initPane();
}
protected void initPane(){
new SwingWorker<Integer, Void>() {
@Override
@ -42,6 +50,7 @@ public abstract class LoadingBasicPane extends BasicPane {
}
private void initCards() {
card = new CardLayout();
setLayout(card);

16
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -222,22 +222,18 @@ public class TemplateFileTree extends EnvFileTree {
String fileName = fileNode.getEnvPath();
String[] auPaths = auPath.split(CoreConstants.SEPARATOR);
String[] nodePaths = fileName.split(CoreConstants.SEPARATOR);
if (auPaths.length == nodePaths.length) {
// 待判断目录是有权限目录或者有权限目录的子目录,全部权限
if (auPaths.length <= nodePaths.length) {
for (int i = 0; i < auPaths.length; i++) {
if (!auPaths[i].equals(nodePaths[i])) {
return false;
}
}
return fileNode.isDirectory();
} else {
int len = Math.min(auPaths.length, nodePaths.length);
for (int i = 0; i < len; i++) {
if (!auPaths[i].equals(nodePaths[i])) {
return false;
}
}
return true;
}
// 其他情况半权限
else {
return false;
}
}

67
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -1,13 +1,9 @@
package com.fr.design.utils;
import com.fr.base.BaseUtils;
import com.fr.base.EnvException;
import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.dav.DavXMLUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.DesignerEnvProcessor;
@ -17,8 +13,6 @@ import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralContext;
import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CodeUtils;
@ -32,16 +26,12 @@ import javax.swing.*;
import java.awt.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URI;
@ -417,61 +407,6 @@ public class DesignUtils {
* @throws Exception 异常
*/
public static boolean sendFeedBack(FeedBackInfo feedBackInfo) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
// 把tableData写成xml文件到out
DavXMLUtils.writeXMLFeedBackInfo(feedBackInfo, out);
InputStream input = postBytes2ServerB(out.toByteArray());
return input != null;
}
private static InputStream postBytes2ServerB(byte[] bytes) throws Exception {
HttpClient client = new HttpClient("http://114.215.175.35:8080/WebReport/product_advice.jsp");
client.asGet();
client.setContent(bytes);
return execute4InputStream(client);
}
/**
* execute method之后,取返回的inputstream
*/
private static ByteArrayInputStream execute4InputStream(HttpClient client) throws Exception {
int statusCode = client.getResponseCode();
if (statusCode != HttpURLConnection.HTTP_OK) {
throw new EnvException("Method failed: " + statusCode);
}
InputStream in = client.getResponseStream();
if (in == null) {
return null;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
Utils.copyBinaryTo(in, out);
// 看一下传过来的byte[]是不是DesignProcessor.INVALID,如果是的话,就抛Exception
byte[] bytes = out.toByteArray();
// carl:格式一致传中文
String message = new String(bytes, EncodeConstants.ENCODING_UTF_8);
if (ComparatorUtils.equals(message, RemoteDeziConstants.NO_SUCH_RESOURCE)) {
return null;
} else if (ComparatorUtils.equals(message, RemoteDeziConstants.INVALID_USER)) {
throw new EnvException(RemoteDeziConstants.INVALID_USER);
} else if (ComparatorUtils.equals(message, RemoteDeziConstants.FILE_LOCKED)) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("FR-Designer_file-is-locked"));
return null;
} else if (message.startsWith(RemoteDeziConstants.RUNTIME_ERROR_PREFIX)) {
}
return new ByteArrayInputStream(bytes);
} finally {
in.close();
out.close();
client.release();
}
return true;
}
}

47
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -23,7 +23,6 @@ import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
@ -115,7 +114,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/**
* 主机位置
*/
private RemoteEnvURL remoteEnvURL = new RemoteEnvURL("");
private RemoteWorkspaceURL remoteWorkspaceURL = new RemoteWorkspaceURL("");
/**
* https 配置面板
*/
@ -189,7 +188,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
fileChooserButton.setEnabled(isHttps);
updateHttpsConfigPanel();
remoteEnvURL.setHttps(isHttps);
remoteWorkspaceURL.setHttps(isHttps);
fillRemoteEnvURLField();
fillIndividualField();
}
@ -267,9 +266,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
public void populateBean(RemoteDesignerWorkspaceInfo ob) {
WorkspaceConnection connection = ob.getConnection();
if (connection != null) {
this.remoteEnvURL = Strings.isNullOrEmpty(connection.getUrl())
? RemoteEnvURL.createDefaultURL()
: new RemoteEnvURL(connection.getUrl());
this.remoteWorkspaceURL = Strings.isNullOrEmpty(connection.getUrl())
? RemoteWorkspaceURL.createDefaultURL()
: new RemoteWorkspaceURL(connection.getUrl());
String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY);
String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY);
String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY);
@ -280,17 +279,17 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.certSecretKeyInput.setText(certSecretKey);
} else {
this.remoteEnvURL = RemoteEnvURL.createDefaultURL();
this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL();
this.usernameInput.setText(StringUtils.EMPTY);
this.passwordInput.setText(StringUtils.EMPTY);
}
fillRemoteEnvURLField();
fillIndividualField();
httpsCheckbox.setSelected(this.remoteEnvURL.getHttps());
httpsCheckbox.setSelected(this.remoteWorkspaceURL.getHttps());
DesignerEnvManager.getEnvManager().setHttps(this.remoteEnvURL.getHttps());
fileChooserButton.setEnabled(this.remoteEnvURL.getHttps());
DesignerEnvManager.getEnvManager().setHttps(this.remoteWorkspaceURL.getHttps());
fileChooserButton.setEnabled(this.remoteWorkspaceURL.getHttps());
updateHttpsConfigPanel();
@ -299,7 +298,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override
public RemoteDesignerWorkspaceInfo updateBean() {
WorkspaceConnection connection = new WorkspaceConnection(
this.remoteEnvURL.getURL(),
this.remoteWorkspaceURL.getURL(),
this.usernameInput.getText(),
new String(this.passwordInput.getPassword()),
this.certPathInput.getText(),
@ -576,7 +575,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
*/
private void fillRemoteEnvURLField() {
remoteEnvURLInput.getDocument().removeDocumentListener(overallDocListener);
remoteEnvURLInput.setText(remoteEnvURL.getURL());
remoteEnvURLInput.setText(remoteWorkspaceURL.getURL());
remoteEnvURLInput.getDocument().addDocumentListener(overallDocListener);
}
@ -584,14 +583,14 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* 自动填充子条目输入框
*/
private void fillIndividualField() {
if (remoteEnvURL == null) {
if (remoteWorkspaceURL == null) {
return;
}
disableSubDocListener();
hostNameInput.setText(remoteEnvURL.hasDefaultHostName() ? StringUtils.EMPTY : remoteEnvURL.getHost());
portInput.setText(remoteEnvURL.getPort());
webAppNameInput.setText(remoteEnvURL.getWeb());
servletNameInput.setText(remoteEnvURL.getServlet());
hostNameInput.setText(remoteWorkspaceURL.hasDefaultHostName() ? StringUtils.EMPTY : remoteWorkspaceURL.getHost());
portInput.setText(remoteWorkspaceURL.getPort());
webAppNameInput.setText(remoteWorkspaceURL.getWeb());
servletNameInput.setText(remoteWorkspaceURL.getServlet());
enableSubDocListener();
}
@ -601,11 +600,11 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
String port = portInput.getText();
String web = webAppNameInput.getText();
String servlet = servletNameInput.getText();
remoteEnvURL.setHttps(isHttps);
remoteEnvURL.setHost(host);
remoteEnvURL.setPort(port);
remoteEnvURL.setWeb(web);
remoteEnvURL.setServlet(servlet);
remoteWorkspaceURL.setHttps(isHttps);
remoteWorkspaceURL.setHost(host);
remoteWorkspaceURL.setPort(port);
remoteWorkspaceURL.setWeb(web);
remoteWorkspaceURL.setServlet(servlet);
}
@ -617,10 +616,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
}
private void actionURLInputChange() {
remoteEnvURL = new RemoteEnvURL(remoteEnvURLInput.getText());
remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
fillIndividualField();
httpsCheckbox.setSelected(remoteEnvURL.getHttps());
httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());
boolean isHttps = httpsCheckbox.isSelected();
DesignerEnvManager.getEnvManager().setHttps(isHttps);
fileChooserButton.setEnabled(isHttps);

30
designer-base/src/main/java/com/fr/env/RemoteEnvURL.java → designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -8,7 +8,7 @@ import java.util.Objects;
/**
* @author yaohwu
*/
public class RemoteEnvURL implements FCloneable {
public class RemoteWorkspaceURL implements FCloneable {
/**
* 默认 hostname
@ -17,20 +17,20 @@ public class RemoteEnvURL implements FCloneable {
/**
* 默认 web app name
*/
private static final String DEFAULT_WEB_APP_NAME = "WebReport";
private static final String DEFAULT_WEB_APP_NAME = "webroot";
/**
* 默认 servlet name
*/
private static final String DEFAULT_SERVLET_NAME = "ReportServer";
private static final String DEFAULT_SERVLET_NAME = "decision";
/**
* 默认端口
*/
private static final String DEFAULT_PORT = "8080";
private static final String DEFAULT_PORT = "8075";
private static final String HTTPS = "https://";
private static final String HTTP = "http://";
public static final RemoteEnvURL DEFAULT_URL =
new RemoteEnvURL(
public static final RemoteWorkspaceURL DEFAULT_URL =
new RemoteWorkspaceURL(
false,
DEFAULT_HOST_NAME,
DEFAULT_PORT,
@ -45,12 +45,12 @@ public class RemoteEnvURL implements FCloneable {
/**
* 解析 url 字符串 生成 RemoteEnvURL 对象
* 解析 url 字符串 生成 RemoteWorkspaceURL 对象
* url 字符串格式 (http(s)://)host(:port)/+web/+servlet/+(others)
*
* @param url x:x/x/x/x
*/
public RemoteEnvURL(String url) {
public RemoteWorkspaceURL(String url) {
// 没有写协议名称 默认 使用 http 协议
if (!url.startsWith(HTTPS) && !url.startsWith(HTTP)) {
@ -102,12 +102,12 @@ public class RemoteEnvURL implements FCloneable {
return DEFAULT_HOST_NAME.equals(host);
}
public static RemoteEnvURL createDefaultURL() {
public static RemoteWorkspaceURL createDefaultURL() {
return DEFAULT_URL.clone();
}
public RemoteEnvURL(boolean isHttps, String host, String port, String web, String servlet) {
public RemoteWorkspaceURL(boolean isHttps, String host, String port, String web, String servlet) {
this.isHttps = isHttps;
this.host = host != null ? host.trim() : StringUtils.EMPTY;
this.port = port != null ? port.trim() : StringUtils.EMPTY;
@ -172,7 +172,7 @@ public class RemoteEnvURL implements FCloneable {
if (o == null || getClass() != o.getClass()) {
return false;
}
RemoteEnvURL that = (RemoteEnvURL) o;
RemoteWorkspaceURL that = (RemoteWorkspaceURL) o;
return isHttps == that.isHttps &&
Objects.equals(host, that.host) &&
Objects.equals(port, that.port) &&
@ -188,7 +188,7 @@ public class RemoteEnvURL implements FCloneable {
@Override
public String toString() {
return "RemoteEnvURL{" +
return "RemoteWorkspaceURL{" +
"isHttps=" + isHttps +
", host='" + host + '\'' +
", port='" + port + '\'' +
@ -198,10 +198,10 @@ public class RemoteEnvURL implements FCloneable {
}
@Override
public RemoteEnvURL clone() {
RemoteEnvURL cloned;
public RemoteWorkspaceURL clone() {
RemoteWorkspaceURL cloned;
try {
cloned = (RemoteEnvURL) super.clone();
cloned = (RemoteWorkspaceURL) super.clone();
return cloned;
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable

82
designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java vendored

@ -14,71 +14,71 @@ public class RemoteEnvURLTest {
public void testURLParser() {
String a;
RemoteEnvURL b;
RemoteWorkspaceURL b;
// https or http begin
a = "www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
Assert.assertFalse(b.getHttps());
a = "http://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
Assert.assertFalse(b.getHttps());
a = "https://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
Assert.assertTrue(b.getHttps());
// https or http end
// host begin
a = "https://www.baidu.com/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("www.baidu.com", b.getHost());
a = "https://baidu.com/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("baidu.com", b.getHost());
a = "https://192.168.1/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("192.168.1", b.getHost());
a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost());
a = "https://a.b.c.d.e.f/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("a.b.c.d.e.f", b.getHost());
// host end
//port begin
a = "https://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("9090", b.getPort());
a = "https://www.baidu.com:/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getPort());
a = "https://www.baidu.com/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getPort());
a = "https://www.baidu.com:kk/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("kk", b.getPort());
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort());
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort());
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort());
//port end
@ -86,109 +86,109 @@ public class RemoteEnvURLTest {
//web begin
a = "https://www.baidu.com:9090///";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getWeb());
a = "https://www.baidu.com:9090";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getWeb());
a = "https://www.baidu.com:9090/";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getWeb());
a = "https://www.baidu.com:9090///web///servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("web", b.getWeb());
a = "https://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("web", b.getWeb());
a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb());
a = "https://www.baidu.com:9090/web///servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("web", b.getWeb());
a = "https://www.baidu.com:9090///web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("web", b.getWeb());
//web end
//servlet begin
a = "https://www.baidu.com:9090///web////servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("servlet", b.getServlet());
a = "https://www.baidu.com:9090";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com:9090/";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com:9090//";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com:9090//web";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com:9090//web//";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com:9090//web/";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com:9090//web//";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com:9090//web/a/";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("a", b.getServlet());
a = "https://www.baidu.com:9090//web/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("a", b.getServlet());
a = "https://www.baidu.com:9090//web/a//";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("a", b.getServlet());
a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet());
a = "https://www.baidu.com//web//";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("", b.getServlet());
a = "https://www.baidu.com//web/a/";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("a", b.getServlet());
a = "https://www.baidu.com//web/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("a", b.getServlet());
a = "https://www.baidu.com//web/a//";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
assertEquals("a", b.getServlet());
// servlet end
//others begin
a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a";
b = new RemoteEnvURL(a);
b = new RemoteWorkspaceURL(a);
Assert.assertTrue(b.getHttps());
assertEquals("www.baidu.com", b.getHost());
assertEquals("", b.getPort());

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
@ -11,21 +12,10 @@ import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/**
* Created by XiaXiang on 2017/3/27.
@ -40,9 +30,9 @@ public class FileSearchManager implements AlphaFineSearchProvider {
private SearchResult lessModelList;
private SearchResult moreModelList;
private String searchText;
private List<FileNode> fileNodes = null;
private FileNode[] fileNodes = null;
//停止搜索
private boolean stopSearch = false;
//隐藏的搜索功能,可根据特殊的字符标记判断搜索分类
private boolean isContainCpt = true;
private boolean isContainFrm = true;
@ -58,9 +48,6 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return instance;
}
public synchronized static void init() {
}
/**
* 根据文件路径获取文件模型
@ -84,52 +71,52 @@ public class FileSearchManager implements AlphaFineSearchProvider {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Templates")));
return lessModelList;
}
fileNodes = new ArrayList<>();
fileNodes = listTpl(ProjectConstants.REPORTLETS_NAME, true);
AlphaFineHelper.checkCancel();
fileNodes = FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true);
isContainCpt = true;
isContainFrm = true;
doSearch(this.searchText, true);
if (stopSearch) {
lessModelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Templates"), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE));
lessModelList.addAll(filterModelList.subList(0, AlphaFineConstants.SHOW_SIZE));
stopSearch = false;
return this.lessModelList;
}
doSearch(this.searchText);
if (filterModelList.isEmpty()) {
return new SearchResult();
} else if (filterModelList.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Templates")));
lessModelList.addAll(filterModelList);
} else {
lessModelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Templates"), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE));
lessModelList.addAll(filterModelList.subList(0, AlphaFineConstants.SHOW_SIZE));
moreModelList.addAll(filterModelList.subList(AlphaFineConstants.SHOW_SIZE, filterModelList.size()));
}
lessModelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Templates"), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_AlphaFine_ShowAll"), false, CellType.FILE));
lessModelList.addAll(filterModelList);
return lessModelList;
}
@Override
public SearchResult getMoreSearchResult(String searchText) {
if (moreModelList != null && !moreModelList.isEmpty()) {
return moreModelList;
}
this.filterModelList = new SearchResult();
this.moreModelList = new SearchResult();
AlphaFineHelper.checkCancel();
isContainCpt = true;
isContainFrm = true;
doSearch(this.searchText, false);
moreModelList.addAll(filterModelList.subList(AlphaFineConstants.SHOW_SIZE, filterModelList.size()));
return moreModelList;
}
private void doSearch(String searchText, boolean needMore) {
for (FileNode node : fileNodes) {
boolean isAlreadyContain = false;
isAlreadyContain = searchFile(searchText, node, isAlreadyContain, needMore);
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent() && node.getLock() == null) {
searchFileContent(searchText, node, isAlreadyContain, needMore);
private void doSearch(String searchText) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) {
for (FileNode node : fileNodes) {
if (node.getName().toLowerCase().contains(searchText)) {
FileModel model = new FileModel(node.getName(), node.getEnvPath());
if (!AlphaFineHelper.getFilterResult().contains(model)) {
AlphaFineHelper.checkCancel();
filterModelList.add(model);
}
}
}
if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE && stopSearch) {
return;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) {
FileNode[] fileNodes = FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true);
for (FileNode node : fileNodes) {
FileModel model = new FileModel(node.getName(), node.getEnvPath());
if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) {
AlphaFineHelper.checkCancel();
filterModelList.add(model);
}
}
}
}
@ -144,113 +131,6 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return searchText;
}
/**
* 搜索文件内容
*
* @param searchText
* @param node
* @param isAlreadyContain
*/
private void searchFileContent(String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) {
try {
InputStream inputStream = new ByteArrayInputStream(WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1))));
InputStreamReader isr = new InputStreamReader(inputStream, "UTF-8");
BufferedReader reader = new BufferedReader(isr);
String line;
int columnNumber;
boolean isFoundInContent = false;
while ((line = reader.readLine()) != null) {
columnNumber = line.toLowerCase().indexOf(searchText);
if (columnNumber != -1) {
isFoundInContent = true;
break;
}
}
if (isFoundInContent && !isAlreadyContain) {
FileModel model = new FileModel(node.getName(), node.getEnvPath());
if (!AlphaFineHelper.getFilterResult().contains(model)) {
AlphaFineHelper.checkCancel();
filterModelList.add(model);
}
if (this.filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) {
stopSearch = true;
}
}
isr.close();
reader.close();
} catch (Exception e) {
FineLoggerFactory.getLogger().error("file read error: " + e.getMessage());
}
}
/**
* 搜索模板
*
* @param searchText
* @param node
* @param isAlreadyContain
* @return
*/
private boolean searchFile(String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) {
if (node.getName().toLowerCase().contains(searchText)) {
FileModel model = new FileModel(node.getName(), node.getEnvPath());
if (!AlphaFineHelper.getFilterResult().contains(model)) {
AlphaFineHelper.checkCancel();
filterModelList.add(model);
}
if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) {
stopSearch = true;
}
isAlreadyContain = true;
}
}
return isAlreadyContain;
}
/**
* 获取工作目录下所有符合要求的模板
*
* @param rootFilePath
* @param recurse
* @return
*/
private List<FileNode> listTpl(String rootFilePath, boolean recurse) {
List<FileNode> fileNodeList = new ArrayList<FileNode>();
try {
listAll(rootFilePath, fileNodeList, recurse);
} catch (Exception e) {
FRContext.getLogger().error("file search error: " + e.getMessage(), e);
}
return fileNodeList;
}
/**
* 获取当前工作目录下所有模板
*
* @param rootFilePath
* @param nodeList
* @param recurse
* @throws Exception
*/
private void listAll(String rootFilePath, List<FileNode> nodeList, boolean recurse) throws Exception {
FileNode[] fns = FRContext.getFileNodes().list(rootFilePath);
for (int i = 0; i < fns.length; i++) {
FileNode fileNode = fns[i];
if (fileNode.isDirectory()) {
if (recurse) {
listAll(rootFilePath + File.separator + fns[i].getName(), nodeList, true);
} else {
nodeList.add(fns[i]);
}
} else if (isContainCpt && fileNode.isFileType("cpt")) {
nodeList.add(fileNode);
} else if (isContainFrm && fileNode.isFileType("frm")) {
nodeList.add(fileNode);
}
}
}
/**
* 是否包含cpt

14
designer-realize/src/main/java/com/fr/design/webattr/ReportWriteAttrPane.java

@ -11,8 +11,11 @@ import com.fr.design.write.submit.SubmitVisitorListPane;
import com.fr.report.worksheet.WorkSheet;
import com.fr.report.write.ReportWriteAttr;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
public class ReportWriteAttrPane extends LoadingBasicPane {
private SubmitVisitorListPane submiterListPane;
@ -25,6 +28,13 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
}
public ReportWriteAttrPane(ElementCasePane ePane){
this.ePane = ePane;
//REPORT-9958 这边需要赋值后再初始化面板
super.initPane();
}
@Override
protected void initPane(){
}
@Override

Loading…
Cancel
Save