forked from fanruan/design
21 changed files with 449 additions and 170 deletions
@ -0,0 +1,62 @@ |
|||||||
|
package com.fr.env; |
||||||
|
|
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.stable.AssistUtils; |
||||||
|
import com.fr.workspace.WorkContext; |
||||||
|
import com.fr.workspace.connect.WorkspaceConnectionInfo; |
||||||
|
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; |
||||||
|
|
||||||
|
/** |
||||||
|
* 测试连接的结果。 |
||||||
|
* 不改变原有逻辑的情况下,加入一层转化。 |
||||||
|
* 根据这里的转化结果,判断需要提示哪些内容。 |
||||||
|
* |
||||||
|
* created by Harrison on 2018/12/20 |
||||||
|
**/ |
||||||
|
public enum TestConnectionResult { |
||||||
|
/** |
||||||
|
* 完全成功, 版本匹配,测试连接成功。 |
||||||
|
*/ |
||||||
|
Fully_Success, |
||||||
|
|
||||||
|
/** |
||||||
|
* 不完全成功,版本不匹配,但测试连接成功。 |
||||||
|
*/ |
||||||
|
Partly_Sucess, |
||||||
|
|
||||||
|
/** |
||||||
|
* 完全失败,直接没连上 |
||||||
|
*/ |
||||||
|
Fully_Failed, |
||||||
|
|
||||||
|
/** |
||||||
|
* 验证 Token 失败 |
||||||
|
*/ |
||||||
|
Auth_Failed; |
||||||
|
|
||||||
|
public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) { |
||||||
|
if (value == null) { |
||||||
|
return Auth_Failed; |
||||||
|
} |
||||||
|
|
||||||
|
if (!value) { |
||||||
|
return Fully_Failed; |
||||||
|
} |
||||||
|
try { |
||||||
|
|
||||||
|
String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); |
||||||
|
if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { |
||||||
|
return Fully_Success; |
||||||
|
} |
||||||
|
|
||||||
|
return Partly_Sucess; |
||||||
|
} catch (Exception e) { |
||||||
|
|
||||||
|
// 发生异常,说明没连接上。返回完全失败。
|
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage()); |
||||||
|
return Fully_Failed; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -1 +1 @@ |
|||||||
假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,servletURL指的是:/WebReport/ReportServer |
假如访问的是http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL指的是:/webroot/decision/view/report |
@ -1 +1 @@ |
|||||||
http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,servletURL is /WebReport/ReportServer |
http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL is /webroot/decision/view/report |
@ -0,0 +1,29 @@ |
|||||||
|
package com.fr.form.ui; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.designer.creator.XCreatorUtils; |
||||||
|
import com.fr.design.mainframe.FormSelectionUtils; |
||||||
|
import com.fr.form.main.Form; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import junit.framework.TestCase; |
||||||
|
|
||||||
|
import java.awt.Dimension; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author kerry |
||||||
|
* @date 2018/7/27 |
||||||
|
*/ |
||||||
|
public class WidgetNameCopyTest extends TestCase { |
||||||
|
|
||||||
|
public void testWidgetNameCopy() throws Exception { |
||||||
|
Widget button = new FreeButton(); |
||||||
|
Form form = new Form(); |
||||||
|
button.setWidgetName("button0"); |
||||||
|
XCreator xCreator = XCreatorUtils.createXCreator(button, new Dimension(100, 100)); |
||||||
|
XCreator copyXcreator1 = FormSelectionUtils.copyXcreator(form, xCreator); |
||||||
|
XCreator copyXcreator2 = FormSelectionUtils.copyXcreator(form, xCreator); |
||||||
|
copyXcreator1.toData().setWidgetName("button_test"); |
||||||
|
assertTrue(!ComparatorUtils.equals(copyXcreator2.toData().getWidgetName(), copyXcreator1.toData().getWidgetName())); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue