Browse Source

Merge pull request #2466 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '4b9fd57d68227f692d7f44bcee5278a42f6bf575':
  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 备份文件夹内残存文件夹没有清理
research/11.0
superman 4 years ago
parent
commit
a2e6f140fc
  1. 46
      designer-base/src/main/java/com/fr/design/style/FormatPane.java
  2. 129
      designer-base/src/main/java/com/fr/design/update/factory/DirectoryOperationFactory.java
  3. 4
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java
  4. 4
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  5. 40
      designer-base/src/main/java/com/fr/design/update/utils/UpdateFileUtils.java
  6. 22
      designer-base/src/test/java/com/fr/design/update/utils/UpdateFileUtilsTest.java
  7. 2
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  8. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  9. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java
  10. 3
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java
  11. 10
      designer-chart/src/main/java/com/fr/van/chart/map/designer/VanMapAreaPointAndLineGroupPane.java
  12. 27
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  13. 3
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  14. 4
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
  15. 9
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js
  16. 2
      designer-form/src/main/java/com/fr/design/mainframe/TopXCreators.java
  17. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

46
designer-base/src/main/java/com/fr/design/style/FormatPane.java

@ -45,7 +45,7 @@ import java.util.Date;
*/
public class FormatPane extends BasicPane {
private static final long serialVersionUID = 724330854437726751L;
private Format format;
private UILabel sampleLabel; //preview label.
private UIRadioButton nullRadioButton;
@ -59,14 +59,14 @@ public class FormatPane extends BasicPane {
//content pane.
private UITextField patternTextField = null;
private JList patternList = null;
/**
* Constructor.
*/
public FormatPane() {
this.initComponents();
}
public UILabel getSampleLabel() {
return sampleLabel;
}
@ -74,7 +74,7 @@ public class FormatPane extends BasicPane {
public void setSampleLabel(UILabel sampleLabel) {
this.sampleLabel = sampleLabel;
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
@ -172,7 +172,7 @@ public class FormatPane extends BasicPane {
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style");
}
/**
* Populate
*/
@ -185,17 +185,17 @@ public class FormatPane extends BasicPane {
} else {
if (format instanceof DecimalFormat) {
checkDecimalFormat();
} else if (format instanceof SimpleDateFormat) {
} else if (format instanceof SimpleDateFormat) {
//date and time
checkDateFormat();
} else if (format instanceof TextFormat) {
checkDateFormat();
} else if (format instanceof TextFormat) {
//Text
this.textRadioButton.setSelected(true);
this.applyRadioActionListener(this.textRadioButton);
}
}
}
private void checkDateFormat() {
String pattern = ((SimpleDateFormat) format).toPattern();
if(pattern == null) {
@ -276,7 +276,7 @@ public class FormatPane extends BasicPane {
}
}
}
/**
* 百分比面板
*/
@ -296,7 +296,7 @@ public class FormatPane extends BasicPane {
/**
* 是否属于数组中的列表样式
*
*
* @param stringArray 格式数组
* @param pattern 输入的格式
* @return 返回在数组中的位置
@ -323,7 +323,7 @@ public class FormatPane extends BasicPane {
}
return FormatField.getInstance().getFormat(getFormatContents(), text);
}
private int getFormatContents(){
if (nullRadioButton.isSelected())
return FormatContents.NULL;
@ -335,7 +335,7 @@ public class FormatPane extends BasicPane {
return FormatContents.PERCENT;
else if (scientificRadioButton.isSelected())
return FormatContents.SCIENTIFIC;
else if (dateRadioButton.isSelected())
else if (dateRadioButton.isSelected())
return FormatContents.DATE;
else if (timeRadioButton.isSelected())
return FormatContents.TIME;
@ -380,7 +380,7 @@ public class FormatPane extends BasicPane {
ActionEvent evt = new ActionEvent(radioButton, 100, "");
this.radioActionListener.actionPerformed(evt);
}
/**
* Radio selection listener.
*/
@ -393,6 +393,7 @@ public class FormatPane extends BasicPane {
patternTextField.setEditable(true);
patternList.setEnabled(true);
int contents = getContents(source);
String[] patternArray = FormatField.getInstance().getFormatArray(contents);
@ -407,6 +408,7 @@ public class FormatPane extends BasicPane {
//maybe need to select the first item.
String text = patternTextField.getText();
if (hasPattenText(text, patternModel)) {
String pattern = null;
if (format instanceof DecimalFormat) {
@ -418,6 +420,10 @@ public class FormatPane extends BasicPane {
if (pattern != null) {
patternList.setSelectedValue(pattern, true);
if (patternList.getSelectedIndex() == -1) {
//patten不在下拉框里面
patternList.setSelectedIndex(0);
}
} else {
patternList.setSelectedIndex(0);
}
@ -426,13 +432,13 @@ public class FormatPane extends BasicPane {
};
private boolean hasPattenText (String text, DefaultListModel patternModel) {
return (text == null || text.length() <= 0) && patternModel.size() > 0;
return StringUtils.isEmpty(text) && patternModel.size() > 0;
}
private void setPatternTextEnable() {
patternTextField.setEnabled(false);
patternTextField.setEditable(false);
patternTextField.setText("");
patternTextField.setText(StringUtils.EMPTY);
patternList.setEnabled(false);
}
@ -459,7 +465,7 @@ public class FormatPane extends BasicPane {
}
return contents;
}
/**
* text pattern document listener.
*/
@ -477,7 +483,7 @@ public class FormatPane extends BasicPane {
refreshPreviewLabel();
}
};
/**
* Pattern list selection listener.
*/
@ -487,5 +493,5 @@ public class FormatPane extends BasicPane {
patternTextField.setText((String) patternList.getSelectedValue());
}
};
}

129
designer-base/src/main/java/com/fr/design/update/factory/DirectoryOperationFactory.java

@ -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);
}
}

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

@ -4,7 +4,7 @@ import com.fr.decision.update.data.UpdateConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.utils.UpdateFileUtils;
import com.fr.design.update.ui.widget.ColorfulCellRender;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
@ -86,7 +86,7 @@ public class RestoreDialog extends JDialog {
JPanel jarListPane = new JPanel();
jarListPane.setLayout(new BoxLayout(jarListPane, BoxLayout.Y_AXIS));
String[] jarBackupFiles = DirectoryOperationFactory.listFilteredFiles(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR);
String[] jarBackupFiles = UpdateFileUtils.listFilteredFiles(StableUtils.getInstallHome(), UpdateConstants.DESIGNER_BACKUP_DIR);
ArrayUtils.reverse(jarBackupFiles);
String[] jarFilesList = ((jarBackupFiles.length < NUMOFCELL_LEAST) ? Arrays.copyOf(jarBackupFiles, NUMOFCELL_LEAST) : jarBackupFiles);

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

@ -17,7 +17,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.actions.FileProcess;
import com.fr.design.update.domain.UpdateInfoCachePropertyManager;
import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.utils.UpdateFileUtils;
import com.fr.design.update.ui.widget.LoadingLabel;
import com.fr.design.update.ui.widget.UpdateActionLabel;
import com.fr.design.update.ui.widget.UpdateInfoTable;
@ -320,7 +320,7 @@ public class UpdateMainDialog extends UIDialog {
}
});
//choose RestoreLabel to show
boolean isNeedRestore = ArrayUtils.isNotEmpty(DirectoryOperationFactory.listFilteredFiles(StableUtils.getInstallHome(), getBackupDirectory()));
boolean isNeedRestore = ArrayUtils.isNotEmpty(UpdateFileUtils.listFilteredFiles(StableUtils.getInstallHome(), getBackupDirectory()));
jarRestoreLabel = isNeedRestore ? jarRestorePreviousRevision : noJarPreviousRevision;
}

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

@ -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);
}
}

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

@ -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")));
}
}

2
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

@ -5,6 +5,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
@ -276,6 +277,7 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
setRichTextAttr(new AttrTooltipRichText());
Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();

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

@ -195,6 +195,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return richText;
}
public void setRichTextAttr(AttrTooltipRichText richText) {
this.richText = richText;
}
private JPanel createLabelContentPane() {
initDetailPane();
initCenterPane();
@ -583,6 +587,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
attrTooltipContent.getRichTextChangedPercentFormat()
};
richText = new AttrTooltipRichText();
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java

@ -10,7 +10,6 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Nameable;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -154,7 +153,7 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem
HyperDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame(), true);
super(SwingUtilities.getWindowAncestor(VanChartUIListControlPane.this));
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
this.editPane = pane;
JPanel editPaneWrapper = new JPanel(new BorderLayout());

3
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat;
@ -136,6 +137,8 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent instanceof AttrGanttTooltipContent){
setRichTextAttr(new AttrTooltipRichText());
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
Map<String, String> params = getRichTextAttr().getParams();

10
designer-chart/src/main/java/com/fr/van/chart/map/designer/VanMapAreaPointAndLineGroupPane.java

@ -1,10 +1,7 @@
package com.fr.van.chart.map.designer;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.border.Border;
/**
* Created by Mitisky on 16/5/20.
@ -19,9 +16,4 @@ public class VanMapAreaPointAndLineGroupPane extends VanChartGroupPane {
public VanMapAreaPointAndLineGroupPane(final JPanel areaPane, final JPanel pointPane, final JPanel linePane){
super(new String[]{AREA_MAP_STRING, POINT_MAP_STRING, LINE_MAP_STRING}, new JPanel[]{areaPane, pointPane, linePane});
}
@Override
protected Border getButtonGroupBorder () {
return BorderFactory.createEmptyBorder(0,8,0,18);
}
}
}

27
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -41,19 +41,24 @@
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var dimensionIds = [];
var getDimensionIds = function (params) {
var result = [];
var paramGroup = params.split("-");
var paramGroup = params.split("-");
for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":");
var param = {};
for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":");
var param = {};
param[key] = value;
param[key] = value;
result.push(param);
}
dimensionIds.push(param);
return result;
}
var dimensionIds = getDimensionIds(params);
var rich_editor = BI.createWidget({
type: "bi.design.chart.common.editor",
element: "body",
@ -86,8 +91,12 @@
}
});
Pool.dispatch = function(){
rich_editor.setValue({content: Pool.data.getContent(), isAuto: Pool.data.isAuto()});
Pool.dispatch = function () {
rich_editor.setValue({
content: Pool.data.getContent(),
isAuto: Pool.data.isAuto(),
dimensionIds: getDimensionIds(Pool.data.getParams())
});
}
Pool.update = function () {

3
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -170,6 +170,9 @@
this.store.changeIsAuto(obj.isAuto);
this.fontStyleGroup.setValue(obj.isAuto);
}
if (BI.contains(keys, "dimensionIds")) {
this.store.changeDimensionIds(obj.dimensionIds);
}
},
_formatContent: function (content) {

4
designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js

@ -42,6 +42,10 @@
this.model.isAuto = isAuto;
},
changeDimensionIds: function (dimensionIds) {
this.model.dimensionIds = dimensionIds;
},
setEditorBlurState: function (isBlur) {
this.model.isEditorBlur = isBlur;
}

9
designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js

@ -16,13 +16,16 @@
this.addParam(this.model.param, editorService.encode);
this.combo.hideView();
// this._restorePosition();
},
items: function () {
this.adapter.populate(this.model.items);
}
},
render: function () {
var self = this;
var adapter = BI.createWidget({
this.adapter = BI.createWidget({
type: "bi.button_group",
items: this.model.items,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
@ -47,7 +50,7 @@
bgap: 10,
items: [{
type: "bi.searcher",
adapter: adapter,
adapter: this.adapter,
width: 210,
height: 24,
listeners: [{
@ -56,7 +59,7 @@
self.store.changeParam(this.getValue()[0]);
}
}]
}, adapter]
}, this.adapter]
};
return {

2
designer-form/src/main/java/com/fr/design/mainframe/TopXCreators.java

@ -30,7 +30,7 @@ public class TopXCreators extends JComponent {
setBackground(null);
setOpaque(false);
designer.addDesignerEditListener(e -> {
if (e.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
if (e.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || e.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) {
refresh();
}
});

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -61,7 +61,7 @@ public class StylePane extends UIComboBoxPane<Style> {
@Override
protected List<FurtherBasicBeanPane<? extends Style>> initPaneList() {
List<FurtherBasicBeanPane<? extends Style>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Style>>();
List<FurtherBasicBeanPane<? extends Style>> paneList = new ArrayList<>();
paneList.add(customStylePane = new CustomStylePane());
paneList.add(predefinedStylePane = new PredefinedStylePane());
return paneList;

Loading…
Cancel
Save