Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~qinghui.liu/design into release/10.0

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
b31267894c
  1. 50
      designer-base/src/main/java/com/fr/design/update/factory/UpdateFileFactory.java
  2. 2
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java
  3. 2
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  4. 12
      designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java
  5. 28
      designer-base/src/test/java/com/fr/design/update/factory/UpdateFileFactoryTest.java
  6. 11
      designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java
  7. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  8. 3
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

50
designer-base/src/main/java/com/fr/design/update/factory/UpdateFileFactory.java

@ -0,0 +1,50 @@
package com.fr.design.update.factory;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import java.io.File;;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2020-09-29
*/
public class UpdateFileFactory {
private UpdateFileFactory() {
}
public static File[] getBackupVersions() {
File[] versions = null;
try {
File backupDir = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR));
StableUtils.mkdirs(backupDir);
versions = backupDir.listFiles();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return versions;
}
public static boolean isBackupVersionsValid(String version) {
boolean designerValid = false;
boolean envValid = false;
try {
File designerLib = new File(StableUtils.pathJoin(version, UpdateConstants.DESIGNERBACKUPPATH));
File[] jars = designerLib.listFiles();
if (jars != null && jars.length > 0) {
designerValid = true;
}
File envLib = new File(StableUtils.pathJoin(version, UpdateConstants.BACKUPPATH));
jars = envLib.listFiles();
if (jars != null && jars.length > 0) {
envValid = true;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return designerValid && envValid;
}
}

2
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java

@ -86,7 +86,7 @@ public class RestoreDialog extends JDialog {
JPanel jarListPane = new JPanel(); JPanel jarListPane = new JPanel();
jarListPane.setLayout(new BoxLayout(jarListPane, BoxLayout.Y_AXIS)); jarListPane.setLayout(new BoxLayout(jarListPane, BoxLayout.Y_AXIS));
String[] jarBackupFiles = UpdateFileUtils.listFilteredFiles(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR); String[] jarBackupFiles = UpdateFileUtils.listBackupVersions();
ArrayUtils.reverse(jarBackupFiles); ArrayUtils.reverse(jarBackupFiles);
String[] jarFilesList = ((jarBackupFiles.length < NUMOFCELL_LEAST) ? Arrays.copyOf(jarBackupFiles, NUMOFCELL_LEAST) : jarBackupFiles); String[] jarFilesList = ((jarBackupFiles.length < NUMOFCELL_LEAST) ? Arrays.copyOf(jarBackupFiles, NUMOFCELL_LEAST) : jarBackupFiles);

2
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -320,7 +320,7 @@ public class UpdateMainDialog extends UIDialog {
} }
}); });
//choose RestoreLabel to show //choose RestoreLabel to show
boolean isNeedRestore = ArrayUtils.isNotEmpty(UpdateFileUtils.listFilteredFiles(StableUtils.getInstallHome(), getBackupDirectory())); boolean isNeedRestore = ArrayUtils.isNotEmpty(UpdateFileUtils.listBackupVersions());
jarRestoreLabel = isNeedRestore ? jarRestorePreviousRevision : noJarPreviousRevision; jarRestoreLabel = isNeedRestore ? jarRestorePreviousRevision : noJarPreviousRevision;
} }

12
designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java

@ -1,5 +1,6 @@
package com.fr.design.update.utils; package com.fr.design.update.utils;
import com.fr.design.update.factory.UpdateFileFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import java.io.File; import java.io.File;
@ -12,22 +13,17 @@ import java.util.List;
* Created by Bryant on 2020-09-25 * Created by Bryant on 2020-09-25
*/ */
public class UpdateFileUtils { public class UpdateFileUtils {
/** /**
* 列出过滤后的文件 * 列出过滤后的文件
* *
* @param installHome 安装目录
* @param backupdir 备份目录
* @return String数组 * @return String数组
*/ */
public static String[] listFilteredFiles(String installHome, String backupdir) { public static String[] listBackupVersions() {
File backupDir = new File(StableUtils.pathJoin(installHome, backupdir)); File[] versionBackup = UpdateFileFactory.getBackupVersions();
StableUtils.mkdirs(backupDir);
File[] versionBackup = backupDir.listFiles();
List<String> versions = new ArrayList<>(); List<String> versions = new ArrayList<>();
if (versionBackup != null) { if (versionBackup != null) {
for (File file : versionBackup) { for (File file : versionBackup) {
if (file.isDirectory() && file.length() > 0) { if (UpdateFileFactory.isBackupVersionsValid(file.getAbsolutePath())) {
versions.add(file.getName()); versions.add(file.getName());
} else { } else {
StableUtils.deleteFile(file); StableUtils.deleteFile(file);

28
designer-base/src/test/java/com/fr/design/update/factory/UpdateFileFactoryTest.java

@ -0,0 +1,28 @@
package com.fr.design.update.factory;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.stable.StableUtils;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
public class UpdateFileFactoryTest {
@Test
public void testGetBackupVersions() {
Assert.assertEquals(0, UpdateFileFactory.getBackupVersions().length);
File backupDir = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR));
StableUtils.deleteFile(backupDir);
}
@Test
public void testIsBackupVersionsValid() {
File des = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.BACKUPPATH, "test"));
File env = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.DESIGNERBACKUPPATH, "test"));
StableUtils.mkdirs(des);
StableUtils.mkdirs(env);
Assert.assertTrue(UpdateFileFactory.isBackupVersionsValid(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test")));
StableUtils.deleteFile(new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR)));
}
}

11
designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java

@ -1,5 +1,6 @@
package com.fr.design.update.utils; package com.fr.design.update.utils;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -15,8 +16,12 @@ public class UpdateFileUtilsTest {
@Test @Test
public void testListFilteredFiles() { public void testListFilteredFiles() {
String[] result = UpdateFileUtils.listFilteredFiles("home", "backup"); File des = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.BACKUPPATH, "test"));
Assert.assertEquals(0, result.length); File env = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR, "test", UpdateConstants.DESIGNERBACKUPPATH, "test"));
StableUtils.deleteFile(new File(StableUtils.pathJoin("home"))); StableUtils.mkdirs(des);
StableUtils.mkdirs(env);
String[] result = UpdateFileUtils.listBackupVersions();
Assert.assertEquals(1, result.length);
StableUtils.deleteFile(new File(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR)));
} }
} }

21
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -92,7 +92,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private AttrTooltipRichText richText; private AttrTooltipRichText richText;
public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
this.parent = parent; this.parent = parent;
this.showOnPane = showOnPane; this.showOnPane = showOnPane;
this.richText = new AttrTooltipRichText(); this.richText = new AttrTooltipRichText();
@ -101,7 +101,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
initRichTextFormatPane(parent, showOnPane); initRichTextFormatPane(parent, showOnPane);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(createLabelContentPane(),BorderLayout.CENTER); this.add(createLabelContentPane(), BorderLayout.CENTER);
} }
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() { public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() {
@ -330,7 +330,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private JPanel createCommonStylePane() { protected JPanel createCommonStylePane() {
styleButton = new UIButtonGroup<>(new String[]{ styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom") Toolkit.i18nText("Fine-Design_Chart_Custom")
@ -474,8 +474,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
} }
protected double[] getRowSize(double p){ protected double[] getRowSize(double p) {
return new double[]{p,p,p,p}; return new double[]{p, p, p, p};
} }
protected Component[][] getPaneComponents() { protected Component[][] getPaneComponents() {
@ -500,7 +500,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
content.addActionListener(new ActionListener() { content.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkCardPane(); checkCardPane();
} }
}); });
} }
@ -584,8 +584,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
@Override @Override
public void populateBean(AttrTooltipContent attrTooltipContent){ public void populateBean(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent == null){ if (attrTooltipContent == null) {
return; return;
} }
@ -604,7 +604,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if(!attrTooltipContent.isCommon()){ if (!attrTooltipContent.isCommon()) {
setDirty(false); setDirty(false);
} }
@ -801,9 +801,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
* CHART-1295 * CHART-1295
* 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串 * 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串
* 图表对于其他的格式有要求也可以在这里继续添加 * 图表对于其他的格式有要求也可以在这里继续添加
*
* @param attrTooltipContent * @param attrTooltipContent
*/ */
private void updateFormatsWithPaneWidth (AttrTooltipContent attrTooltipContent) { private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth(); int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) { if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false); attrTooltipContent.getSeriesFormat().setEnable(false);

3
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -15,6 +15,7 @@ import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
@ -111,7 +112,7 @@ public class SelectionModel {
if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) { if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) {
XCreator parentContainer = (XCreator) comp.getParent(); XCreator parentContainer = (XCreator) comp.getParent();
if (parentContainer != null) { if (parentContainer != null) {
comp = parentContainer.isDedicateContainer() ? parentContainer : comp; comp = parentContainer.isDedicateContainer() || comp instanceof XCardSwitchButton ? parentContainer : comp;
} }
} }
if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) { if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) {

Loading…
Cancel
Save