Browse Source

Merge remote-tracking branch 'origin/release/11.0' into release/11.0

release/11.0
Leo.Qin 2 years ago
parent
commit
21f815176a
  1. 2
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  2. 1
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  3. 7
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  5. 350
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java
  6. 205
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  7. 10
      designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java
  8. 33
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java
  9. 2
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  10. 30
      designer-base/src/main/java/com/fr/design/locale/impl/DataMaskMark.java
  11. 28
      designer-base/src/main/java/com/fr/design/locale/impl/LineEngineMark.java
  12. 7
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  13. 2
      designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java
  14. 49
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  15. 4
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  16. 39
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  17. 29
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  18. 6
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  19. 23
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  20. 8
      designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java

2
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -68,7 +68,7 @@ public class SwitchExistEnv extends MenuDef {
EnvChangeEntrance.getInstance().chooseEnv(envName); EnvChangeEntrance.getInstance().chooseEnv(envName);
} else { } else {
SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(true); SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(true);
if (saveSomeTemplatePane.showSavePane()) { if (saveSomeTemplatePane.showSavePane(true)) {
// 用户模板保存后,才进行切换目录操作 // 用户模板保存后,才进行切换目录操作
EnvChangeEntrance.getInstance().switch2Env(envName); EnvChangeEntrance.getInstance().switch2Env(envName);
} }

1
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -669,6 +669,7 @@ public abstract class DesignTableDataManager {
if (needLoadingBar) { if (needLoadingBar) {
MultiResultTableDataWrapper.loadingBar.start(); MultiResultTableDataWrapper.loadingBar.start();
} }
parameterMap.put(SqlNoteConstants.SQL_NOTE_TEMPLATE, HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath());
return DataOperator.getInstance().previewMultiResultTableData(tableData, parameterMap, 0); return DataOperator.getInstance().previewMultiResultTableData(tableData, parameterMap, 0);
} }

7
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java

@ -8,10 +8,12 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.locale.impl.DataMaskMark;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -58,7 +60,8 @@ public class DesensitizationOpenPane extends JPanel {
@Override @Override
public void mouseClicked(MouseEvent event) { public void mouseClicked(MouseEvent event) {
try { try {
URL url = new URL(Toolkit.i18nText("Fine-Design_Report_Desensitization_Help_Document_Url")); LocaleMark<String> dataMaskMark = LocaleCenter.getMark(DataMaskMark.class);
URL url = new URL(dataMaskMark.getValue());
Desktop.getDesktop().browse(url.toURI()); Desktop.getDesktop().browse(url.toURI());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e, "open browse of table data desensitization help document failed for {}", e.getMessage()); FineLoggerFactory.getLogger().error(e, "open browse of table data desensitization help document failed for {}", e.getMessage());

7
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -268,7 +268,8 @@ public class HistoryTemplateListCache implements CallbackEvent {
boolean replaceWithJVirtualTemplate = overTemplate.getEditingFILE().exists() boolean replaceWithJVirtualTemplate = overTemplate.getEditingFILE().exists()
&& overTemplate.isALLSaved() && overTemplate.isALLSaved()
&& overTemplate != editingTemplate && overTemplate != editingTemplate
&& overTemplate.checkEnable(); && overTemplate.checkEnable()
&& overTemplate.supportCache();
if (replaceWithJVirtualTemplate) { if (replaceWithJVirtualTemplate) {
closeVirtualSelectedReport(overTemplate); closeVirtualSelectedReport(overTemplate);
historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE())); historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE()));
@ -297,7 +298,9 @@ public class HistoryTemplateListCache implements CallbackEvent {
int index = iterator.nextIndex(); int index = iterator.nextIndex();
if (size == index + 1 && index > 0) { if (size == index + 1 && index > 0) {
//如果删除的是后一个Tab,则定位到前一个 //如果删除的是后一个Tab,则定位到前一个
MultiTemplateTabPane.getInstance().setSelectedIndex(index - 1); MultiTemplateTabPane.getInstance().setSelectedIndex(
MultiTemplateTabPane.getInstance().calNextShowJTemplateIndex(index - 1));
} }
} }
} }

350
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java

@ -0,0 +1,350 @@
package com.fr.design.file;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.TemplateUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.CollectionUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 右侧下拉菜单的工厂类
* @author Carlson
* @since 11.0
* created on 2023-04-14
**/
public class MultiTemplateTabMenuFactory {
private static final Icon CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
private static final Icon MOUSE_OVER_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png");
private static final Icon MOUSE_PRESS_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png");
private static final int ITEM_SIZE = 25;
private UIScrollPopUpMenu menu = null;
private static MultiTemplateTabMenuFactory INSTANCE = new MultiTemplateTabMenuFactory();
private MultiTemplateTabMenuFactory() {
}
/**
* 返回右侧下拉菜单的工厂类
* @return
*/
public static MultiTemplateTabMenuFactory getInstance() {
return INSTANCE;
}
/**
* tab上的下拉菜单
*/
public UIScrollPopUpMenu createMenu() {
menu = new UIScrollPopUpMenu();
menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0));
menu.add(initCloseOther());
menu.add(createEmptyRow());
menu.addSeparator();
menu.add(createEmptyRow());
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Current_Category_Templates")));
Component[] items = createCurrentCategory();
for (Component item : items) {
menu.add(item);
}
items = createOtherCategory();
if (items.length > 0) {
menu.addSeparator();
menu.add(createEmptyRow());
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Other_Category_Templates")));
for (Component item : items) {
menu.add(item);
}
}
Dimension dimension = menu.getPreferredSize();
dimension.width += ITEM_SIZE;
menu.setPreferredSize(dimension);
return menu;
}
/**
* 关闭其它按钮
*/
private UIMenuItem initCloseOther() {
UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Basic_Tab_Close_Other_Templates_Of_Current_Category"));
closeOther.setHorizontalAlignment(SwingConstants.CENTER);
Dimension dimension = closeOther.getPreferredSize();
dimension.height = ITEM_SIZE;
closeOther.setPreferredSize(dimension);
String currentOperator = getCurrentTabOperatorType();
closeOther.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
MultiTemplateTabPane.getInstance().closeAllByOperatorType(currentOperator);
}
});
if (MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(currentOperator).size() <= 1) {
closeOther.setEnabled(false);
}
return closeOther;
}
/**
* 美观用
*/
private JPanel createEmptyRow() {
return new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
};
}
/**
* 模板分类item
*/
private UIButton createCategory(String categoryName) {
UIButton button = new UIButton(categoryName);
button.setBorderPainted(false);
button.setExtraPainted(false);
button.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setHorizontalAlignment(SwingConstants.LEFT);
button.setForeground(UIConstants.FLESH_BLUE);
return button;
}
/**
* 创建 当前分类模板 item数组
*/
private Component[] createCurrentCategory() {
return createListDownItem(MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(getCurrentTabOperatorType()));
}
private String getCurrentTabOperatorType(){
JTemplate jTemplate= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return jTemplate.getTemplateTabOperatorType();
}
/**
* 创建 其它分类模板 item数组
*/
private Component[] createOtherCategory() {
String currentOperator = getCurrentTabOperatorType();
List<JTemplate<?, ?>> openedTemplates = new ArrayList<>();
Map<String, List<JTemplate<?, ?>>> map = MultiTemplateTabPane.getInstance().getOpenedJTemplatesByCategory();
for (Map.Entry<String, List<JTemplate<?, ?>>> entry : map.entrySet()) {
if (!StringUtils.equals(currentOperator, entry.getKey())) {
openedTemplates.addAll(entry.getValue());
}
}
return createListDownItem(openedTemplates);
}
/**
* 根据template列表创建多个item
*/
private Component[] createListDownItem(List<JTemplate<?, ?>> openedTemplates) {
if (!CollectionUtils.isEmpty(openedTemplates)) {
Component[] templates = new Component[openedTemplates.size()];
for (int i = 0; i < openedTemplates.size(); i++) {
templates[i] = createListDownMenuItem(openedTemplates.get(i));
}
return templates;
}
return new Component[0];
}
/**
* 根据template对象创建item
*/
private Component createListDownMenuItem(JTemplate<?, ?> template) {
JPanel jPanel = new JPanel();
jPanel.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE));
jPanel.setLayout(new BorderLayout());
MenuItemButtonGroup menuItemButtonGroup = new MenuItemButtonGroup(template);
if (template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()) {
menuItemButtonGroup.templateButton.setForeground(UIConstants.FLESH_BLUE);
}
jPanel.add(menuItemButtonGroup.iconButton, BorderLayout.WEST);
jPanel.add(menuItemButtonGroup.templateButton, BorderLayout.CENTER);
jPanel.add(menuItemButtonGroup.closeButton, BorderLayout.EAST);
return jPanel;
}
/**
* menu的item由模板图标模板名模板关闭按钮组成
*/
private class MenuItemButtonGroup {
private final UIButton iconButton;
private final UIButton templateButton;
private final UIButton closeButton;
public MenuItemButtonGroup(JTemplate<?, ?> template) {
iconButton = createIconButton(template);
templateButton = createTemplateButton(template);
closeButton = createCloseButton();
initListener(template);
}
/**
* item[0] 模板图标按钮初始化
*/
private UIButton createIconButton(JTemplate<?, ?> template) {
UIButton button = new UIButton(template.getIcon(), template.getIcon(), template.getIcon());
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
return button;
}
/**
* item[1] 切换模板按钮初始化
*/
private UIButton createTemplateButton(JTemplate<?, ?> template) {
UIButton button = new UIButton(TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()));
button.setBorderPainted(false);
button.setExtraPainted(false);
button.setPreferredSize(new Dimension(menu.getWidth() - ITEM_SIZE * 2, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setHorizontalAlignment(SwingConstants.LEFT);
return button;
}
/**
* item[2] 关闭模板图标按钮初始化
*/
private UIButton createCloseButton() {
UIButton button = new UIButton(CLOSE, MOUSE_OVER_CLOSE, MOUSE_PRESS_CLOSE);
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setVisible(false);
return button;
}
private void initListener(JTemplate<?, ?> template) {
initIconButtonListener();
initTemplateButtonListener(template);
initCloseButtonListener(template);
}
/**
* item[0] 模板图标按钮鼠标事件
*/
private void initIconButtonListener() {
iconButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* item[1] 切换模板按钮鼠标事件
*/
private void initTemplateButtonListener(JTemplate<?, ?> template) {
templateButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().switchJTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* item[2] 关闭模板按钮鼠标事件
*/
private void initCloseButtonListener(JTemplate<?, ?> template) {
closeButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().closeFormat(template);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* mouse移入item范围
*/
private void fireMouseEnteredEvent() {
iconButton.setBackground(UIConstants.HOVER_BLUE);
templateButton.setBackground(UIConstants.HOVER_BLUE);
closeButton.setBackground(UIConstants.HOVER_BLUE);
closeButton.setVisible(true);
}
/**
* mouse移出item范围
*/
private void fireMouseExitedEvent() {
iconButton.setBackground(UIConstants.NORMAL_BACKGROUND);
templateButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.setVisible(false);
}
}
}

205
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -1,7 +1,6 @@
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
@ -19,7 +18,6 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.TemplateSavingChecker; import com.fr.design.mainframe.TemplateSavingChecker;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.design.worker.WorkerManager; import com.fr.design.worker.WorkerManager;
@ -42,7 +40,6 @@ import javax.swing.JComponent;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.MenuElement; import javax.swing.MenuElement;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
@ -70,6 +67,8 @@ import java.awt.geom.Line2D;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
@ -333,8 +332,10 @@ public class MultiTemplateTabPane extends JComponent {
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
closeTemplate(templates, currentTemplate); closeTemplate(templates, currentTemplate);
if (option == CloseOption.All) { if (openedTemplate.size() == 0) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(); DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} else if (option == CloseOption.All){
DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(0));
} else { } else {
DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate); DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate);
} }
@ -344,8 +345,9 @@ public class MultiTemplateTabPane extends JComponent {
} }
private void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) { private void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) {
String operator = currentTemplate.getTemplateTabOperatorType();
for (int i = 0; i < templates.length; i++) { for (int i = 0; i < templates.length; i++) {
if (option.shouldClose(tplIndex, i)) { if (option.shouldClose(tplIndex, i) && ComparatorUtils.equals(operator, templates[i].getTemplateTabOperatorType())) {
JTemplate<?, ?> jTemplate = templates[i]; JTemplate<?, ?> jTemplate = templates[i];
if (jTemplate == currentTemplate) { if (jTemplate == currentTemplate) {
currentTemplate = option == CloseOption.All ? null : templates[tplIndex]; currentTemplate = option == CloseOption.All ? null : templates[tplIndex];
@ -378,6 +380,47 @@ public class MultiTemplateTabPane extends JComponent {
return openedTemplate.get(selectedIndex); return openedTemplate.get(selectedIndex);
} }
/**
* 关闭所有指定模板tab操作类型的模板
* @param operatorType
*/
public void closeAllByOperatorType(String operatorType){
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false);
if (saveSomeTempaltePane.showSavePane()) {
List<JTemplate<?, ?>> openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList();
JTemplate<?, ?>[] templates = new JTemplate<?, ?>[openedTemplate.size()];
for (int i = 0; i < openedTemplate.size(); i++) {
templates[i] = openedTemplate.get(i);
}
closeTemplate(templates, operatorType);
if (openedTemplate.size() == 0) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} else {
DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(0));
}
MultiTemplateTabPane.getInstance().repaint();
}
}
/**
* 关闭指定模板
* @param templates
* @param operatorType
*/
private static void closeTemplate(JTemplate<?, ?>[] templates, String operatorType) {
for (int i = 0; i < templates.length; i++) {
JTemplate<?, ?> jTemplate = templates[i];
if (!ComparatorUtils.equals(operatorType, jTemplate.getTemplateTabOperatorType())){
continue;
}
MultiTemplateTabPane.getInstance().closeFormat(jTemplate);
HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate);
MultiTemplateTabPane.getInstance().closeAndFreeLock(jTemplate);
}
}
/** /**
* 关闭掉当前已打开文件列表中指定的文件 * 关闭掉当前已打开文件列表中指定的文件
@ -478,11 +521,7 @@ public class MultiTemplateTabPane extends JComponent {
private String tempalteShowName(JTemplate<?, ?> template) { private String tempalteShowName(JTemplate<?, ?> template) {
String name = TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()); return template.getTabShowName(template);
if (!template.isSaved() && !name.endsWith(" *")) {
name += " *";
}
return name;
} }
/** /**
@ -500,40 +539,7 @@ public class MultiTemplateTabPane extends JComponent {
private void showListDown() { private void showListDown() {
UIScrollPopUpMenu menu = MultiTemplateTabMenuFactory.getInstance().createMenu();
UIScrollPopUpMenu menu = new UIScrollPopUpMenu();
menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0));
menu.add(initCloseOther());
JSeparator separator = new JSeparator() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
};
menu.add(new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
});
separator.setForeground(UIConstants.LINE_COLOR);
menu.add(separator);
menu.add(new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
});
UIMenuItem[] items = createListDownTemplate();
for (int i = 0; i < items.length; i++) {
menu.add(items[i]);
}
GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), MultiTemplateTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight()); GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), MultiTemplateTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight());
} }
@ -583,6 +589,9 @@ public class MultiTemplateTabPane extends JComponent {
//从可以开始展示在tab面板上的tab开始画 //从可以开始展示在tab面板上的tab开始画
for (int i = minPaintIndex; i <= maxPaintIndex; i++) { for (int i = minPaintIndex; i <= maxPaintIndex; i++) {
JTemplate template = openedTemplate.get(i); JTemplate template = openedTemplate.get(i);
if (!showJTemplateTab(template)){
continue;
}
Icon icon = template.getIcon(); Icon icon = template.getIcon();
String name = tempalteShowName(template); String name = tempalteShowName(template);
//如果tab名字的长度大于最大能显示的英文字符长度,则进行省略号处理 //如果tab名字的长度大于最大能显示的英文字符长度,则进行省略号处理
@ -722,8 +731,10 @@ public class MultiTemplateTabPane extends JComponent {
//个数小于最多能容纳的个数的情况下,看看宽度每个要画多少 //个数小于最多能容纳的个数的情况下,看看宽度每个要画多少
private void calculateRealAverageWidth(double maxwidth, int templateNum) { private void calculateRealAverageWidth(double maxwidth, int templateNum) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
List<JTemplate<?, ?>> showTemplates = getOpenedJTemplatesByOperator(jTemplate.getTemplateTabOperatorType());
int num = openedTemplate.size() > templateNum ? templateNum : openedTemplate.size(); int num = Math.min(showTemplates.size(), templateNum);
realWidth = (int) (maxwidth / (num)); realWidth = (int) (maxwidth / (num));
if (realWidth > MAXWIDTH) { if (realWidth > MAXWIDTH) {
realWidth = MAXWIDTH; realWidth = MAXWIDTH;
@ -932,7 +943,7 @@ public class MultiTemplateTabPane extends JComponent {
activePrevTemplateAfterClose(); activePrevTemplateAfterClose();
} }
private void closeAndFreeLock(@Nonnull JTemplate<?, ?> template) { public void closeAndFreeLock(@Nonnull JTemplate<?, ?> template) {
FILE file = template.getEditingFILE(); FILE file = template.getEditingFILE();
// 只有是环境内的文件,才执行释放锁 // 只有是环境内的文件,才执行释放锁
if (file != null && file.isEnvFile()) { if (file != null && file.isEnvFile()) {
@ -988,7 +999,7 @@ public class MultiTemplateTabPane extends JComponent {
// 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界 // 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界
if (selectedIndex >= maxPaintIndex) { if (selectedIndex >= maxPaintIndex) {
// selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true
selectedIndex--; selectedIndex = calNextShowJTemplateIndex(selectedIndex - 1);
} }
isCloseCurrent = false; isCloseCurrent = false;
} }
@ -1005,6 +1016,26 @@ public class MultiTemplateTabPane extends JComponent {
} }
} }
/**
* 计算下一个可以展示的模板index
* @param currentIndex
* @return
*/
public int calNextShowJTemplateIndex(int currentIndex) {
//先看是否有可以展示的模板
for (int i = currentIndex; i >= 0; i--) {
if (showJTemplateTab(openedTemplate.get(i))) {
return i;
}
}
for (int i = currentIndex; i >= 0; i--) {
if (!showJTemplateTab(openedTemplate.get(i))) {
return i;
}
}
return -1;
}
private boolean isOverCloseIcon(int evtX) { private boolean isOverCloseIcon(int evtX) {
boolean isOverCloseIcon = false; boolean isOverCloseIcon = false;
@ -1027,7 +1058,7 @@ public class MultiTemplateTabPane extends JComponent {
private int getTemplateIndex(int evtX) { private int getTemplateIndex(int evtX) {
int textX = 0; int textX = 0;
for (int i = minPaintIndex; i <= maxPaintIndex; i++) { for (int i = minPaintIndex; i <= maxPaintIndex; i++) {
int textWidth = realWidth; int textWidth = showJTemplateTab(openedTemplate.get(i)) ? realWidth : 0;
if (evtX >= textX && evtX < textX + textWidth) { if (evtX >= textX && evtX < textX + textWidth) {
return i; return i;
} }
@ -1184,29 +1215,44 @@ public class MultiTemplateTabPane extends JComponent {
//没有点击关闭和ListDown按钮,则切换到点击的模板处 //没有点击关闭和ListDown按钮,则切换到点击的模板处
closeIconIndex = -1; closeIconIndex = -1;
clodeMode = CLOSE; clodeMode = CLOSE;
int tempSelectedIndex = selectedIndex; switchJTemplate(getTemplateIndex(evtX));
if (selectedIndex != getTemplateIndex(evtX) && getTemplateIndex(evtX) != -1) {
openedTemplate.get(selectedIndex).stopEditing();
selectedIndex = getTemplateIndex(evtX);
//如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
MultiTemplateTabPane.this.repaint();
return;
}
JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX));
evtXTemplate.activeNewJTemplate();
}
isShowList = false; isShowList = false;
} }
MultiTemplateTabPane.this.repaint(); MultiTemplateTabPane.this.repaint();
} }
}
/**
* 切换到指定模板
* @param jTemplate
*/
public void switchJTemplate(JTemplate jTemplate) {
int switchIndex = this.openedTemplate.indexOf(jTemplate);
if (switchIndex >= 0) {
switchJTemplate(switchIndex);
}
}
/**
* 切换到指定index
* @param switchIndex
*/
private void switchJTemplate(int switchIndex){
int tempSelectedIndex = selectedIndex;
if (selectedIndex != switchIndex && switchIndex != -1) {
openedTemplate.get(selectedIndex).stopEditing();
selectedIndex = switchIndex;
//如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
MultiTemplateTabPane.this.repaint();
return;
}
JTemplate evtXTemplate = openedTemplate.get(switchIndex);
evtXTemplate.activeNewJTemplate();
}
} }
private boolean checkCurrentClose(JTemplate template) { private boolean checkCurrentClose(JTemplate template) {
@ -1251,5 +1297,34 @@ public class MultiTemplateTabPane extends JComponent {
} }
} }
/**
* 判断是否显示在tab栏上
* @param jTemplate
* @return
*/
private boolean showJTemplateTab(JTemplate jTemplate){
JTemplate current = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return ComparatorUtils.equals(current.getTemplateTabOperatorType(), jTemplate.getTemplateTabOperatorType());
}
/**
* 获取tab操作类型的模板
* @param operator
* @return
*/
public List<JTemplate<?, ?>> getOpenedJTemplatesByOperator(String operator) {
return openedTemplate.stream().filter((jTemplate) -> ComparatorUtils.equals(jTemplate.getTemplateTabOperatorType(), operator))
.collect(Collectors.toList());
}
/**
* 根据tab操作类型进行分类
* @return
*/
public Map<String, List<JTemplate<?, ?>>> getOpenedJTemplatesByCategory() {
return openedTemplate.stream()
.collect(Collectors.groupingBy(JTemplate::getTemplateTabOperatorType));
}
} }

10
designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java

@ -81,11 +81,19 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
} }
if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) { if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) {
newWorkBookIconMode = getMousePressNew(); newWorkBookIconMode = getMousePressNew();
DesignerContext.getDesignerFrame().addAndActivateJTemplate(); createNewTemplate();
} }
this.repaint(); this.repaint();
} }
/**
* 新建模板
*/
protected void createNewTemplate() {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
}
/** /**
*鼠标松开 *鼠标松开
* @param e 事件 * @param e 事件

33
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

@ -47,6 +47,7 @@ public class SaveSomeTemplatePane extends BasicPane {
/** /**
* 支持自定义设置 dialog的父窗口 * 支持自定义设置 dialog的父窗口
*
* @param isNeedTojudgeCurrent * @param isNeedTojudgeCurrent
* @param parent * @param parent
*/ */
@ -79,11 +80,14 @@ public class SaveSomeTemplatePane extends BasicPane {
this.isJudgeCurrentEditingTemplate = isNeedTojudgeCurrent; this.isJudgeCurrentEditingTemplate = isNeedTojudgeCurrent;
} }
private void initTemplatesChoosePane() {
private void initTemplatesChoosePane(boolean judgeJTemplateMustSave) {
templatesChoosePane.setBorder(BorderFactory.createTitledBorder("")); templatesChoosePane.setBorder(BorderFactory.createTitledBorder(""));
for (int i = 0; i < unSavedTemplate.size(); i++) { for (int i = 0; i < unSavedTemplate.size(); i++) {
templateCheckBoxes[i] = new UICheckBox(unSavedTemplate.get(i).getEditingFILE().getName()); templateCheckBoxes[i] = new UICheckBox(unSavedTemplate.get(i).getEditingFILE().getName());
templateCheckBoxes[i].setSelected(true); templateCheckBoxes[i].setSelected(true);
boolean needSave = judgeJTemplateMustSave && unSavedTemplate.get(i).needSaveBeforeSwitchEnv();
templateCheckBoxes[i].setEnabled(!needSave);
} }
final UIList templatesList = new UIList(templateCheckBoxes); final UIList templatesList = new UIList(templateCheckBoxes);
@ -103,7 +107,10 @@ public class SaveSomeTemplatePane extends BasicPane {
boolean isSelected = chooseAllCheckBox.isSelected(); boolean isSelected = chooseAllCheckBox.isSelected();
for (int i = 0; i < templatesList.getModel().getSize(); i++) { for (int i = 0; i < templatesList.getModel().getSize(); i++) {
UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(i); UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(i);
checkBox.setSelected(isSelected); boolean mustSaveBeforeSwitchEnv = judgeJTemplateMustSave && unSavedTemplate.get(i).needSaveBeforeSwitchEnv();
checkBox.setSelected(mustSaveBeforeSwitchEnv || isSelected);
templateCheckBoxes[i].setEnabled(!mustSaveBeforeSwitchEnv);
} }
templatesList.repaint(); templatesList.repaint();
} }
@ -139,7 +146,7 @@ public class SaveSomeTemplatePane extends BasicPane {
/** /**
* 获取templateCheckBoxes中状态为选中状态的CheckBox数量 * 获取templateCheckBoxes中状态为选中状态的CheckBox数量
* */ */
private int calculateSelectedNum() { private int calculateSelectedNum() {
int count = 0; int count = 0;
for (UICheckBox checkBox : templateCheckBoxes) { for (UICheckBox checkBox : templateCheckBoxes) {
@ -152,7 +159,11 @@ public class SaveSomeTemplatePane extends BasicPane {
public boolean showSavePane() { public boolean showSavePane() {
populate(); return showSavePane(false);
}
public boolean showSavePane(boolean judgeJTemplateMustSave) {
populate(judgeJTemplateMustSave);
//如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目 //如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目
if (!unSavedTemplate.isEmpty()) { if (!unSavedTemplate.isEmpty()) {
dialog.setVisible(true); dialog.setVisible(true);
@ -162,8 +173,12 @@ public class SaveSomeTemplatePane extends BasicPane {
return isAllSaved; return isAllSaved;
} }
public void populate() { protected java.util.List<JTemplate<?, ?>> getOpenedTemplatesToProcess(){
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); return HistoryTemplateListPane.getInstance().getHistoryList();
}
public void populate(boolean judgeJTemplateMustSave) {
java.util.List<JTemplate<?, ?>> opendedTemplate = getOpenedTemplatesToProcess();
JTemplate<?, ?> currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
for (int i = 0; i < opendedTemplate.size(); i++) { for (int i = 0; i < opendedTemplate.size(); i++) {
if (isneedToAdd(opendedTemplate.get(i), currentTemplate)) { if (isneedToAdd(opendedTemplate.get(i), currentTemplate)) {
@ -171,10 +186,10 @@ public class SaveSomeTemplatePane extends BasicPane {
} }
} }
templateCheckBoxes = new UICheckBox[unSavedTemplate.size()]; templateCheckBoxes = new UICheckBox[unSavedTemplate.size()];
initTemplatesChoosePane(); initTemplatesChoosePane(judgeJTemplateMustSave);
} }
private boolean isneedToAdd(JTemplate<?, ?> template, JTemplate<?, ?> currentTemplate) { protected boolean isneedToAdd(JTemplate<?, ?> template, JTemplate<?, ?> currentTemplate) {
//所有模板都判断是不是保存 //所有模板都判断是不是保存
if (isJudgeCurrentEditingTemplate) { if (isJudgeCurrentEditingTemplate) {
return !template.isALLSaved(); return !template.isALLSaved();
@ -194,7 +209,7 @@ public class SaveSomeTemplatePane extends BasicPane {
specifiedTemplate.stopEditing(); specifiedTemplate.stopEditing();
return specifiedTemplate.saveTemplate(); return specifiedTemplate.saveTemplate();
} }
FineLoggerFactory.getLogger().info( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
return true; return true;
} }

2
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -391,7 +391,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
} }
private void updateHelpDocuments(Object value, List<HelpDocument> helpDocuments) { private void updateHelpDocuments(Object value, List<HelpDocument> helpDocuments) {
String url = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT); String url = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT) + value.toString();
try { try {
String result = HttpToolbox.get(url); String result = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(result); JSONObject jsonObject = new JSONObject(result);

30
designer-base/src/main/java/com/fr/design/locale/impl/DataMaskMark.java

@ -0,0 +1,30 @@
package com.fr.design.locale.impl;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.general.locale.LocaleMark;
/**
* 根据图片信息生成获取国际化服务器图标工具
*
* @author obo
* @since 11.0
* Created on 2023/4/19
*/
public class DataMaskMark implements LocaleMark<String> {
/**
* 云中心数据脱敏帮助链接链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Data_Mask";
/**
* 云中心数据脱敏默认帮助链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design_Report_Desensitization_Help_Document_Url";
@Override
public String getValue() {
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

28
designer-base/src/main/java/com/fr/design/locale/impl/LineEngineMark.java

@ -0,0 +1,28 @@
package com.fr.design.locale.impl;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.general.locale.LocaleMark;
/**
* 根据国际化获取启用行式引擎执行层式报表帮助文档链接
*
* @author obo
* @since 11.0
* Created on 2023/4/19
*/
public class LineEngineMark implements LocaleMark<String> {
/**
* 云中心启用行式引擎执行层式报表帮助链接链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Line_Engine";
/**
* 云中心启用行式引擎执行层式报表默认帮助链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Line_Engine_Default";
@Override
public String getValue() {
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

7
designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java

@ -311,4 +311,11 @@ public class CenterRegionContainerPane extends JPanel {
return toolbarComponentState; return toolbarComponentState;
} }
/**
* 重置下RegionContainerpane
*/
public void resetCenterRegionContainerPane(){
templateTabPane.add(MultiTemplateTabPane.getInstance(), BorderLayout.CENTER);
}
} }

2
designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java

@ -2,7 +2,6 @@ package com.fr.design.mainframe;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -24,6 +23,7 @@ public class DefaultToolKitConfig implements ToolKitConfigStrategy {
@Override @Override
public JPanel customNorthPane(JPanel toolBarPane, ToolBarMenuDockPlus plus) { public JPanel customNorthPane(JPanel toolBarPane, ToolBarMenuDockPlus plus) {
CenterRegionContainerPane.getInstance().resetCenterRegionContainerPane();
return toolBarPane; return toolBarPane;
} }
} }

49
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -58,6 +58,7 @@ import com.fr.design.module.DesignModuleFactory;
import com.fr.design.preview.PagePreview; import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.TemplateUtils;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker; import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import com.fr.design.worker.save.SaveFailureHandler; import com.fr.design.worker.save.SaveFailureHandler;
@ -120,6 +121,8 @@ import java.util.concurrent.Callable;
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件) * 报表设计和表单设计的编辑区域(设计器编辑的IO文件)
*/ */
public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave, TabChangeListener, ThemedTemplate { public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave, TabChangeListener, ThemedTemplate {
private static final String DEFAULT_TAB_OPERATOR = "DefaultTabOperator";
// TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
private static final int PREDEFINED_ICON_WIDTH = 27; private static final int PREDEFINED_ICON_WIDTH = 27;
@ -2060,4 +2063,50 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public static boolean isValid(JTemplate jt) { public static boolean isValid(JTemplate jt) {
return jt != null && jt != JNullTemplate.NULL; return jt != null && jt != JNullTemplate.NULL;
} }
/**
* 获取此模板所使用的tab栏操作类型
* @return
*/
public String getTemplateTabOperatorType(){
return DEFAULT_TAB_OPERATOR;
}
/**
* 当前模板是否可以被保存
* @return /
*/
public boolean canBeSaved(){
return true;
}
/**
* 当前的模板是否支持缓存
*
* @return /
*/
public boolean supportCache(){
return true;
}
/**
* 获取此模板在tab栏中显示的名称
* @return
*/
public String getTabShowName(JTemplate<?, ?> jTemplate){
String name = TemplateUtils.createLockeTemplatedName(jTemplate, jTemplate.getTemplateName());
if (!jTemplate.isSaved() && !name.endsWith(" *")) {
name += " *";
}
return name;
}
/**
* 切换环境之前是否需要保存
* @return
*/
public boolean needSaveBeforeSwitchEnv(){
return false;
}
} }

4
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -416,9 +416,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new OpenRecentReportMenuDef()); menuDef.addShortCut(new OpenRecentReportMenuDef());
if (!DesignModeContext.isDuchampMode()) { addCloseCurrentTemplateAction(menuDef);
addCloseCurrentTemplateAction(menuDef);
}
scs = plus.shortcut4FileMenu(); scs = plus.shortcut4FileMenu();
if (!ArrayUtils.isEmpty(scs)) { if (!ArrayUtils.isEmpty(scs)) {

39
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -129,6 +129,10 @@ public class FILEChooserPane extends BasicPane {
public static final int JOPTIONPANE_CANCEL_OPTION = 3; public static final int JOPTIONPANE_CANCEL_OPTION = 3;
public static final String SEPARATOR_STRING = "/";
public static final char SEPARATOR_CHAR = '/';
/** /**
* alex:之所以在Pattern那里加个+,是因为有些路径会有两个甚至多个分隔符放在一起 * alex:之所以在Pattern那里加个+,是因为有些路径会有两个甚至多个分隔符放在一起
@ -1466,10 +1470,17 @@ public class FILEChooserPane extends BasicPane {
for (int i = 0; i < this.buttonList.size(); i++) { for (int i = 0; i < this.buttonList.size(); i++) {
this.buttonList.get(i).setForeground(null); this.buttonList.get(i).setForeground(null);
if (((SetDirectoryAction) this.buttonList.get(i).getAction()).getDir() != null if (((SetDirectoryAction) this.buttonList.get(i).getAction()).getDir() != null
&& this.buttonList.get(i).getAction() instanceof SetDirectoryAction && this.buttonList.get(i).getAction() instanceof SetDirectoryAction) {
&& (ComparatorUtils.equals(((SetDirectoryAction) this.buttonList.get(i).getAction()).getDir().getPath(), dir.getPath()))) { String actionPath = ((SetDirectoryAction) this.buttonList.get(i).getAction()).getDir().getPath();
String dirPath = dir.getPath();
this.buttonList.get(i).setForeground(Color.BLUE); //如果是报表环境,button的Action最后会跟上"/",这个是特意处理的,但是对应代码没有说明原因,不做修改
//FILE的getPath不会带"/",这边针对这种情况加个处理,不建议直接改FILE
if (actionPath.endsWith(SEPARATOR_STRING) && !dirPath.endsWith(SEPARATOR_STRING)) {
dirPath = dirPath + SEPARATOR_STRING;
}
if (ComparatorUtils.equals(actionPath, dirPath)) {
this.buttonList.get(i).setForeground(Color.BLUE);
}
} }
} }
} }
@ -1479,7 +1490,7 @@ public class FILEChooserPane extends BasicPane {
} }
public void populate(FILE dir) { public void populate(FILE dir) {
if (popDir != null && dir != null && popDir.toString().indexOf(dir.toString()) == 0) { if (checkOnlyHighLight(dir)) {
highLightButton(dir); highLightButton(dir);
return; return;
} }
@ -1530,6 +1541,24 @@ public class FILEChooserPane extends BasicPane {
highLightButton(dir); highLightButton(dir);
} }
/**
* 检查是不是只需要设置高亮即可
*
* @param dir FILE
* @return 如果还要进行别的设置就返回false,如果只需要更新下高亮(通过点击上面的路径才会只需要更新高亮),返回true
*/
private boolean checkOnlyHighLight(FILE dir) {
if (popDir == null || dir == null) {
return false;
}
String popDirStr = popDir.toString();
String dirStr = dir.toString();
//前缀匹配是不够的,还要看下前缀匹配的下一位是不是'/'
//否则"test"和"test副本"明明不属于同个路径逻辑,也只更新高亮,应该是"test"和"test/副本"这样才可以通过
//如果通过了indexOf的检查,因为不会存在相同的路径,popDirStr只会比dirStr大,看一下前缀匹配的下一位是不是'/',如果不是就得更新路径文本,不能只设置高亮
return popDirStr.indexOf(dirStr) == 0 && popDirStr.length() > dirStr.length() && popDirStr.charAt(dirStr.length()) == SEPARATOR_CHAR;
}
// doLayout // doLayout
@Override @Override
public void doLayout() { public void doLayout() {

29
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -97,25 +97,16 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
* @param ePane 面板 * @param ePane 面板
*/ */
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) { public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) {
new SwingWorker<Void, Void>() { String chartID = collection.getSelectedChartProvider(ChartProvider.class).getID();
@Override updateChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID());
protected Void doInBackground() throws Exception { setSupportCellData(true);
GEOJSONHelper.getInstance(); this.container.setEPane(ePane);
return null;
} if (ChartTypeManager.getInstance().chartExit(chartID)) {
@Override chartEditPane.populate(collection);
protected void done() { } else {
String chartID = collection.getSelectedChartProvider(ChartProvider.class).getID(); GUICoreUtils.setEnabled(chartEditPane, false);
updateChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID()); }
setSupportCellData(true);
container.setEPane(ePane);
if (ChartTypeManager.getInstance().chartExit(chartID)) {
chartEditPane.populate(collection);
} else {
GUICoreUtils.setEnabled(chartEditPane, false);
}
}
}.execute();
} }
/** /**

6
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -20,6 +20,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.locale.impl.DataMaskMark;
import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.cell.settingpane.desensitization.CellDesensitizationGroupsPane; import com.fr.design.mainframe.cell.settingpane.desensitization.CellDesensitizationGroupsPane;
@ -28,6 +29,8 @@ import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellDesensitizationAttr; import com.fr.report.cell.cellattr.CellDesensitizationAttr;
import com.fr.report.cell.cellattr.CellGUIAttr; import com.fr.report.cell.cellattr.CellGUIAttr;
@ -156,10 +159,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
// 带超链的提示信息 // 带超链的提示信息
UILabel label = new UILabel(); UILabel label = new UILabel();
LocaleMark<String> dataMaskMark = LocaleCenter.getMark(DataMaskMark.class);
MessageWithLink hyperlink = new MessageWithLink( MessageWithLink hyperlink = new MessageWithLink(
Toolkit.i18nText("Fine-Design_Report_Desensitization_Tip"), Toolkit.i18nText("Fine-Design_Report_Desensitization_Tip"),
Toolkit.i18nText("Fine-Design_Report_Desensitization_Hyperlink"), Toolkit.i18nText("Fine-Design_Report_Desensitization_Hyperlink"),
Toolkit.i18nText("Fine-Design_Report_Desensitization_Help_Document_Url"), dataMaskMark.getValue(),
StringUtils.EMPTY, StringUtils.EMPTY,
label.getBackground(), label.getBackground(),
label.getFont(), label.getFont(),

23
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -32,6 +32,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.server.socket.CustomLogEvent; import com.fr.workspace.server.socket.CustomLogEvent;
import com.fr.workspace.server.socket.LogEventConverter; import com.fr.workspace.server.socket.LogEventConverter;
import io.socket.client.IO; import io.socket.client.IO;
@ -271,6 +272,11 @@ public class DesignerSocketIO {
httpGet.setConfig(requestConfig); httpGet.setConfig(requestConfig);
try { try {
CloseableHttpResponse response = httpclient.execute(httpGet); CloseableHttpResponse response = httpclient.execute(httpGet);
if (isErrorStatus(response.getStatusLine().getStatusCode())) {
//这边nginx做负载,服务器被kill掉,返回的是502,不会抛错,导致checkRPCConnect通过
//针对500-600的错误码加个判断,其他类型的状态码暂不考虑,如果有遇到再处理,不然怕影响范围大
throw new WorkspaceConnectionException("Response " + response.getStatusLine().toString());
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage()); FineLoggerFactory.getLogger().error(e, e.getMessage());
return false; return false;
@ -278,6 +284,23 @@ public class DesignerSocketIO {
return true; return true;
} }
/**
* 错误状态码
* 5xx(服务器错误)这些状态代码表示服务器在尝试处理请求时发生内部错误 这些错误可能是服务器本身的错误而不是请求出错代码 说明
* 500 (服务器内部错误) 服务器遇到错误无法完成请求
* 501 (尚未实施) 服务器不具备完成请求的功能 例如服务器无法识别请求方法时可能会返回此代码
* 502 (错误网关) 服务器作为网关或代理从上游服务器收到无效响应
* 503 (服务不可用) 服务器目前无法使用(由于超载或停机维护) 通常这只是暂时状态
* 504 (网关超时) 服务器作为网关或代理但是没有及时从上游服务器收到请求
* 505 (HTTP 版本不受支持) 服务器不支持请求中所用的 HTTP 协议版本
*
* @param status 错误状态码
* @return 是否是错误状态码
*/
private static boolean isErrorStatus(int status) {
return status >= 500 && status <= 600;
}
//配置变更监听器 //配置变更监听器
private static final Emitter.Listener modifyConfig = new Emitter.Listener() { private static final Emitter.Listener modifyConfig = new Emitter.Listener() {
@Override @Override

8
designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java

@ -11,14 +11,15 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.locale.impl.LineEngineMark;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.SiteCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import com.fr.report.stable.LayerReportAttr; import com.fr.report.stable.LayerReportAttr;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -203,7 +204,8 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("standard.doc", ProductConstants.WEBSITE_URL))); LocaleMark<String> lineEngineMark = LocaleCenter.getMark(LineEngineMark.class);
Desktop.getDesktop().browse(new URI(lineEngineMark.getValue()));
} catch (IOException | URISyntaxException ex) { } catch (IOException | URISyntaxException ex) {
FineLoggerFactory.getLogger().error("io exception or not find website", ex); FineLoggerFactory.getLogger().error("io exception or not find website", ex);
} }

Loading…
Cancel
Save