Browse Source

代码质量

master
XiaXiang 8 years ago
parent
commit
96a8cf3d94
  1. 3
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  2. 15
      designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java
  3. 9
      designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java
  4. 7
      designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java
  5. 8
      designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java
  6. 7
      designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java
  7. 1
      designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java
  8. 2
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

3
designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -88,6 +88,7 @@ public class AlphaFineConstants {
public static final String SERVER_URL = "http://cloud.fanruan.com/api/monitor/record_of_afsearch/single";
public static final String testurl = "http://localhost:8080/monitor/monitor/record_of_afsearch/single";
//TODO:先用本地服务器测试一下,避免影响云中心正常信息收集
public static final String CLOUD_TEST_URL = "http://localhost:8080/monitor/monitor/record_of_afsearch/single";
}

15
designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java

@ -15,19 +15,24 @@ public class CellModelHelper {
private static final String RESULT = "result";
public static AlphaCellModel jsonToModel(JSONObject object) {
int cellType = object.optInt("cellType");
AlphaCellModel cellModel = null;
switch (CellType.parse(cellType)) {
case ACTION:
return ActionSearchManager.getModelFromCloud(object.optString("result"));
cellModel = ActionSearchManager.getModelFromCloud(object.optString(RESULT));
break;
case DOCUMENT:
return DocumentSearchManager.getModelFromCloud(object.optJSONObject("result"));
cellModel = DocumentSearchManager.getModelFromCloud(object.optJSONObject(RESULT));
break;
case FILE:
return FileSearchManager.getModelFromCloud(object.optString("result"));
cellModel = FileSearchManager.getModelFromCloud(object.optString(RESULT));
break;
case PLUGIN:
case REUSE:
return PluginSearchManager.getModelFromCloud(object.optJSONObject("result"));
cellModel = PluginSearchManager.getModelFromCloud(object.optJSONObject(RESULT));
break;
}
return null;
return cellModel;
}
public static String getResultValueFromModel(AlphaCellModel cellModel) {

9
designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java

@ -22,9 +22,12 @@ public class ActionModel extends AlphaCellModel implements Serializable {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ActionModel)) return false;
if (this == o) {
return true;
}
if (!(o instanceof ActionModel)) {
return false;
}
ActionModel that = (ActionModel) o;
return action != null ? action.equals(that.action) : that.action == null;

7
designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java

@ -53,7 +53,12 @@ public class DocumentModel extends AlphaCellModel {
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DocumentModel)) {
return false;
}
DocumentModel that = (DocumentModel) o;
return documentUrl != null ? documentUrl.equals(that.documentUrl) : that.documentUrl == null;

8
designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java

@ -50,9 +50,13 @@ public class FileModel extends AlphaCellModel{
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof FileModel)) {
return false;
}
FileModel fileModel = (FileModel) o;
return filePath != null ? filePath.equals(fileModel.filePath) : fileModel.filePath == null;
}

7
designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java

@ -117,7 +117,12 @@ public class PluginModel extends AlphaCellModel {
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PluginModel)) {
return false;
}
PluginModel that = (PluginModel) o;
return pluginUrl != null ? pluginUrl.equals(that.pluginUrl) : that.pluginUrl == null;

1
designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java

@ -36,6 +36,7 @@ public class TitleCellRender implements ListCellRenderer<Object> {
}
if (moreModel.isLoading()) {
ImageIcon imageIcon = new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/loading.gif"));
//设置cell的加载动画
imageIcon.setImageObserver(list);
UILabel loadingLabel = new UILabel(imageIcon);

2
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -591,7 +591,7 @@ public class AlphaFineDialog extends UIDialog {
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
para.put("token", CodeUtils.md5Encode(date, "", "MD5"));
para.put("content", object.toString());
HttpClient httpClient = new HttpClient(AlphaFineConstants.testurl, para, true);
HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_TEST_URL, para, true);
httpClient.setTimeout(5000);
httpClient.asGet();
if (!httpClient.isServerAlive()) {

Loading…
Cancel
Save