Browse Source

Merge pull request #11771 in DESIGN/design from release/11.0 to bugfix/11.0

* commit '80a731f79bce7c73ca63b630fdefde34c86168cf':
  REPORT-92160 设计器-图标-数据源部分-新建无disable状态
  REPORT-82787 图表空数据提示配置页面,默认图片需补充繁中版
  REPORT-92308 版本管理可用性判断逻辑适配新模式 - 代码格式
  REPORT-91988 设计器编辑服务器数据集出错
  REPORT-92308 版本管理可用性判断逻辑适配新模式
bugfix/11.0
superman 2 years ago
parent
commit
ee2679a86e
  1. 25
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  3. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  4. 9
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  5. 24
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  6. 33
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  7. 37
      designer-chart/src/main/java/com/fr/design/locale/impl/EmptyDataMark.java
  8. 12
      designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java
  9. BIN
      designer-chart/src/main/resources/com/fr/design/images/zh_traditional_emptydata.png

25
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -356,6 +356,8 @@ public class PreferencePane extends BasicPane {
useIntervalCheckBox = new UICheckBox();
//gc面板
JPanel gcControlPane = createGcControlPane();
JPanel enableVcsPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
enableVcsPanel.add(vcsEnableCheckBox);
enableVcsPanel.add(remindVcsLabel);
@ -388,31 +390,10 @@ public class PreferencePane extends BasicPane {
vcsPane.add(enableVcsPanel);
vcsPane.add(intervalPanel);
vcsPane.add(saveCommitCheckBox);
initGcControlPane(vcsPane);
}
private void initGcControlPane(JPanel vcsPane) {
JPanel gcControlPane = createGcControlPane();
new SwingWorker<Boolean, Boolean>() {
@Override
protected Boolean doInBackground() throws Exception {
return WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode();
}
@Override
protected void done() {
try {
if (Boolean.TRUE.equals(get())) {
if (VcsHelper.getInstance().isLegacyMode()) {
// 老版本时才显示gc选项
vcsPane.add(gcControlPane);
vcsPane.updateUI();
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, "[Vcs] retrieve legacy mode error: {}", e.getMessage());
}
}
}.execute();
}
/**

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -229,7 +229,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private TreeSearchToolbarPane initToolBarPane() {
// toolbar
addMenuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add"));
addMenuDef.setIconPath("/com/fr/design/standard/addpopup/addPopup");
addMenuDef.setDisabledIcon("/com/fr/design/standard/addpopup/addPopup", true);
createAddMenuDef();
// 创建插件监听
createPluginListener();

3
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -21,6 +21,7 @@ import com.fr.general.GeneralContext;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.ToolTipManager;
import javax.swing.event.DocumentEvent;
@ -109,6 +110,8 @@ public class ConnectionTableProcedurePane extends BasicPane {
if (parent != null) {
parent.switchTo(SwitchableTableDataPane.CONTENT_PANE_NAME);
}
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.removeElement(EMPTY);
}
@Override

9
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -325,7 +325,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
if (VcsHelper.getInstance().needInit()) {
vcsAction = new VcsAction();
if (!WorkContext.getCurrent().isCluster()) {
if (!isLegacyOnCluster()) {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title"));
} else {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote"));
@ -509,7 +509,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private void fireVcsActionChange(boolean enable) {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
|| VcsHelper.getInstance().isUnSelectedTemplate()
|| WorkContext.getCurrent().isCluster()) {
|| isLegacyOnCluster()) {
setEnabled(false);
return;
}
@ -810,6 +810,11 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}
}
private boolean isLegacyOnCluster() {
// 老模式且为集群,用于代替之前的只判断集群逻辑
return WorkContext.getCurrent().isCluster() && VcsHelper.getInstance().isLegacyMode();
}
private String doCheck (String userInput, String suffix) {
String errorMsg = StringUtils.EMPTY;
if (selectedOperation.duplicated(userInput, suffix, true)) {

24
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -12,6 +12,9 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateActionListener;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.ui.FileVersionTable;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
@ -20,6 +23,8 @@ import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.filesystem.VcsFileSystem;
import com.fr.workspace.server.vcs.git.config.GcConfig;
@ -56,10 +61,22 @@ public class VcsHelper implements JTemplateActionListener {
private final static String SERVICE_NAME_MOVE = "moveVcs";
private static final VcsHelper INSTANCE = new VcsHelper();
private volatile boolean legacyMode;
public static VcsHelper getInstance() {
return INSTANCE;
}
private VcsHelper() {
legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode();
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode();
}
});
}
private int containsFolderCounts() {
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree();
if (fileTree.getSelectionPaths() == null) {
@ -187,6 +204,13 @@ public class VcsHelper implements JTemplateActionListener {
moveVcs.shutdown();
}
/**
* 判断是否为老模式
* @return 是否为老模式
*/
public boolean isLegacyMode() {
return legacyMode;
}
@Override
public void templateOpened(JTemplate<?, ?> jt) {

33
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -3,25 +3,32 @@ package com.fr.design.menu;
import com.fr.base.svg.IconUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.*;
import com.fr.design.gui.imenu.UIHeadMenu;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupEastAttrMenu;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
import javax.swing.*;
import javax.swing.JMenu;
import javax.swing.JPopupMenu;
import javax.swing.JToolBar;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ContainerListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Define Menu.
@ -46,6 +53,7 @@ public class MenuDef extends ShortCut {
protected Boolean isEastAttr = false;
protected char mnemonic;
protected String iconPath;
private boolean needDisabled;
protected String tooltip;
//item List.
private List<ShortCut> shortcutList = new ArrayList<ShortCut>();
@ -112,9 +120,19 @@ public class MenuDef extends ShortCut {
}
public void setIconPath(String iconPath) {
this.iconPath = iconPath;
setDisabledIcon(iconPath, false);
}
/**
* 设置不可用图标时,注意传递路径问题,若路径为"view_normal.svg",请传递"view",不带后缀
* 读取disable图标的文件名应当为"xxx_disabled.svg",也是项目中的svg命名规范
* 注意必须是svg图标路径才能使用此函数设置正常和禁用状态
*
* */
public void setDisabledIcon(String iconPath, boolean needDisabled) {
this.iconPath = iconPath;
this.needDisabled = needDisabled;
}
public int getShortCutCount() {
return this.shortcutList.size();
}
@ -183,6 +201,9 @@ public class MenuDef extends ShortCut {
if (createdButton == null) {
if (iconPath != null) {
createdButton = new UIButton(IconUtils.readIcon(iconPath));
if(needDisabled) {
createdButton.setDisabledIcon(IconUtils.readIcon(iconPath + IconUtils.ICON_TYPE_DISABLED));
}
createdButton.set4ToolbarButton();
} else {
createdButton = new UIButton(name);

37
designer-chart/src/main/java/com/fr/design/locale/impl/EmptyDataMark.java

@ -0,0 +1,37 @@
package com.fr.design.locale.impl;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleMark;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* 根据本地化信息设置服务器图表空数据提示图标
*
* @author obo
* @version 11.0
* Created by obo on 2023/3/22
*/
public class EmptyDataMark implements LocaleMark<BufferedImage> {
private Map<Locale, BufferedImage> map = new HashMap<>();
private static final BufferedImage ZH_EMPTY_DATA = IOUtils.readImage("com/fr/design/images/zh_emptydata.png");
private static final BufferedImage US_EMPTY_DATA = IOUtils.readImage("/com/fr/design/images/us_emptydata.png");
private static final BufferedImage ZH_TRADITIONAL_EMPTY_DATA = IOUtils.readImage("/com/fr/design/images/zh_traditional_emptydata.png");
public EmptyDataMark() {
map.put(Locale.CHINA, ZH_EMPTY_DATA);
map.put(Locale.US, US_EMPTY_DATA);
map.put(Locale.TAIWAN, ZH_TRADITIONAL_EMPTY_DATA);
}
@Override
public BufferedImage getValue() {
BufferedImage result = map.get(GeneralContext.getLocale());
return result == null ? US_EMPTY_DATA : result;
}
}

12
designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java

@ -10,12 +10,13 @@ import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.locale.impl.EmptyDataMark;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.ImageUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
@ -26,7 +27,6 @@ import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingWorker;
import java.io.File;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
@ -35,6 +35,8 @@ import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
/**
* Created by mengao on 2017/11/23.
@ -63,8 +65,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
static {
DEFAULT_EMPTY_DATA_IMAGE = GeneralContext.isChineseEnv() ? IOUtils.readImage("com/fr/design/images/zh_emptydata.png")
: IOUtils.readImage("com/fr/design/images/us_emptydata.png");
LocaleMark<BufferedImage> localeMark = LocaleCenter.getMark(EmptyDataMark.class);
DEFAULT_EMPTY_DATA_IMAGE = localeMark.getValue();
}
@Override

BIN
designer-chart/src/main/resources/com/fr/design/images/zh_traditional_emptydata.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Loading…
Cancel
Save