forked from fanruan/design
Browse Source
* commit '527d4fc2ef3062c1a36261ab29ad6f2a19cb2a78': REPORT-39951 【回归】参数面板上的控件,剪切操作会使控件显示在左上角 【问题原因】SelectionModel中的剪切逻辑在剪切后,会处于一个无组件选择状态,而TopXCreators中的事件没有对剪切事件作出处理,因此在调用design.repaint()的时候,会发现designer中已经没有这个被剪切的组件了,但是TopXCreators还存在这个组件,所以画了出来,也就是显示在了左上角的原因 【改动思路】在TopXCreators中为剪切事件添加处理,剪切后,这边同步刷新一下,保证剪切后的组件也被删掉 CHART-15975 富文本编辑器populate时更新参数 REPORT-39642 设计器菜单栏-服务器-预定义样式-格式修改错误 CHART-15269 && CHART-15926 bugfix REPORT-40472 [回归]修复更新升级还原到以前版本后,还可以还原到以前版本 REPORT-40472 [回归]修复更新升级还原到以前版本后,还可以还原到以前版本 REPORT-40472 备份文件夹内残存文件夹没有清理 REPORT-40472 备份文件夹内残存文件夹没有清理bugfix/10.0
superman
4 years ago
17 changed files with 137 additions and 178 deletions
@ -1,129 +0,0 @@
|
||||
package com.fr.design.update.factory; |
||||
|
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StableUtils; |
||||
|
||||
import java.io.BufferedInputStream; |
||||
import java.io.BufferedOutputStream; |
||||
import java.io.DataInputStream; |
||||
import java.io.DataOutputStream; |
||||
import java.io.File; |
||||
import java.io.FileFilter; |
||||
import java.io.FileInputStream; |
||||
import java.io.FileOutputStream; |
||||
import java.io.IOException; |
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* Created by XINZAI on 2018/8/21. |
||||
*/ |
||||
public class DirectoryOperationFactory { |
||||
/** |
||||
* 新建一个目录 |
||||
* |
||||
* @param dirPath 目录路径 |
||||
*/ |
||||
public static void createNewDirectory(String dirPath) { |
||||
try { |
||||
File newDirPath = new File(dirPath); |
||||
if (!newDirPath.exists()) { |
||||
StableUtils.mkdirs(newDirPath); |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 删除目录 |
||||
* |
||||
* @param dirPath 目录路径 |
||||
*/ |
||||
public static void deleteDirectory(String dirPath) { |
||||
try { |
||||
File dir = new File(dirPath); |
||||
if (dir.isDirectory()) { |
||||
File[] file = dir.listFiles(); |
||||
for (File fileTemp : file) { |
||||
deleteDirectory(fileTemp.toString()); |
||||
fileTemp.delete(); |
||||
} |
||||
} else { |
||||
dir.delete(); |
||||
} |
||||
dir.delete(); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 复制目录 |
||||
* |
||||
* @param oldDirPath 被复制目录 |
||||
* @param newDirPath 新目录 |
||||
*/ |
||||
public static void copyDirectory(String oldDirPath, String newDirPath) { |
||||
File oldDir = new File(oldDirPath); |
||||
if (oldDir.isDirectory()) { |
||||
StableUtils.mkdirs(new File(newDirPath)); |
||||
File[] files = oldDir.listFiles(); |
||||
for (File fileTemp : files) { |
||||
copyDirectory(fileTemp.toString(), newDirPath + "/" + fileTemp.getName()); |
||||
} |
||||
} else { |
||||
try { |
||||
copy(oldDirPath, newDirPath); |
||||
} catch (IOException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static void copy(String path1, String path2) throws IOException { |
||||
try (DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(path1))); |
||||
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(path2)))) { |
||||
byte[] date = new byte[in.available()]; |
||||
in.read(date); |
||||
out.write(date); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 移动目录 |
||||
* |
||||
* @param oldDirPath 被移动目录 |
||||
* @param newDirPath 新目录 |
||||
*/ |
||||
public static void moveDirectory(String oldDirPath, String newDirPath) { |
||||
copyDirectory(oldDirPath, newDirPath); |
||||
deleteDirectory(oldDirPath); |
||||
} |
||||
|
||||
/** |
||||
* 列出过滤后的文件 |
||||
* |
||||
* @param installHome 安装目录 |
||||
* @param backupdir 备份目录 |
||||
* @return String数组 |
||||
*/ |
||||
public static String[] listFilteredFiles(String installHome, String backupdir) { |
||||
File backupDir = new File(StableUtils.pathJoin(installHome, backupdir)); |
||||
StableUtils.mkdirs(backupDir); |
||||
File[] fileNames = backupDir.listFiles(new FileFilter() { |
||||
@Override |
||||
public boolean accept(File pathname) { |
||||
return pathname.isDirectory(); |
||||
} |
||||
}); |
||||
String[] jarFileName = new String[fileNames.length]; |
||||
int j = 0; |
||||
for (File fileName : fileNames) { |
||||
if ((fileName.isDirectory()) && (ArrayUtils.getLength(fileName.listFiles()) > 0)) {//判断备份文件夹中是否为空,为空不显示
|
||||
jarFileName[j++] = fileName.getName(); |
||||
} |
||||
} |
||||
return Arrays.copyOf(jarFileName, j); |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.design.update.utils; |
||||
|
||||
import com.fr.stable.StableUtils; |
||||
|
||||
import java.io.File; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author Bryant |
||||
* @version 10.0 |
||||
* Created by Bryant on 2020-09-25 |
||||
*/ |
||||
public class UpdateFileUtils { |
||||
|
||||
/** |
||||
* 列出过滤后的文件 |
||||
* |
||||
* @param installHome 安装目录 |
||||
* @param backupdir 备份目录 |
||||
* @return String数组 |
||||
*/ |
||||
public static String[] listFilteredFiles(String installHome, String backupdir) { |
||||
File backupDir = new File(StableUtils.pathJoin(installHome, backupdir)); |
||||
StableUtils.mkdirs(backupDir); |
||||
File[] versionBackup = backupDir.listFiles(); |
||||
List<String> versions = new ArrayList<>(); |
||||
if (versionBackup != null) { |
||||
for (File file : versionBackup) { |
||||
if (file.isDirectory() && file.length() > 0) { |
||||
versions.add(file.getName()); |
||||
} else { |
||||
StableUtils.deleteFile(file); |
||||
} |
||||
} |
||||
} |
||||
String[] result = new String[versions.size()]; |
||||
return versions.toArray(result); |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.design.update.utils; |
||||
|
||||
import com.fr.stable.StableUtils; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
import java.io.File; |
||||
|
||||
/** |
||||
* @author Bryant |
||||
* @version 10.0 |
||||
* Created by Bryant on 2020-09-25 |
||||
*/ |
||||
public class UpdateFileUtilsTest { |
||||
|
||||
@Test |
||||
public void testListFilteredFiles() { |
||||
String[] result = UpdateFileUtils.listFilteredFiles("home", "backup"); |
||||
Assert.assertEquals(0, result.length); |
||||
StableUtils.deleteFile(new File(StableUtils.pathJoin("home"))); |
||||
} |
||||
} |
Loading…
Reference in new issue