Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/final/10.0)

* commit '78cba936bf97c599f5117509b4776baacdc5c92d': (44 commits)
  REPORT-60516 10.0release设计器打开cpt很慢
  fix:兼容大屏组件的cpt设置
  REPORT-50201 fix 拼写错误
  REPORT-50201 远程af搜索模板,部分模板右侧加载不出来
  REPORT-60134 表单组件属性国际化-显示不全
  REPORT-59681 远程设计控制模板自适应权限控制
  REPORT-59681 远程设计控制模板自适应权限控制
  CHART-21222 大屏模板中的钻取地图屏蔽钻取目录的超链
  REPORT-59959 设计器-设计器操作-11设计器制作的附件模板,10设计器可以打开;但其他的11做的模板,尝试用10打开时都会正常提示弹窗打不开
  CHART-20937 fix:不新创建editpane但是要重置lastChartCollection 否则不触发保存
  REPORT-59256 填报-填报属性设置-新增自定义提交会带出之前自定义提交设置
  和抽之前完全一样
  CHART-21076 清楚磁盘缓存
  CHART-20411 适配大屏模板关闭
  CHART-20411 适配大屏模板另存为
  REPORT-60004 远程设计-保存弹窗 目录显示问题
  CHART-20686 大屏模板中的图表不支持导出
  CHART-20850 fix:大屏模板中 试管型仪表盘切换为横向后 标签颜色就变了
  CHART-21014 大屏模板中的cpt组件里面还是要有全部图表类型的
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  ...
final/10.0
Henry.Wang 3 years ago
parent
commit
2353f93e1e
  1. 7
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  2. 3
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  3. 3
      designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java
  4. 7
      designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java
  5. 6
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  6. 5
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  7. 36
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  8. 10
      designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java
  9. 15
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  10. 228
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  11. 51
      designer-base/src/main/java/com/fr/design/report/fit/CptFitAttrModel.java
  12. 44
      designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java
  13. 53
      designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java
  14. 10
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  15. 107
      designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java
  16. 18
      designer-base/src/main/java/com/fr/design/report/fit/provider/AbstractFitAttrModelProvider.java
  17. 11
      designer-base/src/main/java/com/fr/design/report/fit/provider/FitAttrModelProvider.java
  18. 42
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  19. 2
      designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java
  20. 19
      designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java
  21. 57
      designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java
  22. 46
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  23. 8
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  24. 25
      designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java
  25. 8
      designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java
  26. 12
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  27. 2
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  28. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  29. 2
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  30. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  31. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  32. 3
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java
  33. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  34. 7
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java
  35. 5
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  36. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java
  37. 18
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  38. 47
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java
  39. 6
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  40. 5
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  41. 2
      designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java
  42. 35
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  43. 16
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  44. 2
      designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java
  45. 35
      designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java
  46. 78
      designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java
  47. 3
      designer-realize/src/main/java/com/fr/grid/Grid.java
  48. 11
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  49. 3
      designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java
  50. 2
      designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java
  51. 2
      designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

7
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -121,7 +121,12 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
while(itemIt.hasNext()) {
model.addElement(itemIt.next());
}
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1);
// 如果加载成功 但是下拉框是可见的 下拉框高度是会固定为原始高度 不会因为填充了更多下拉项而变化
// 需要重新设置下拉框高度 但值一样时相关事件不会生效 所以先加再减下
if (itemComboBox.isPopupVisible()) {
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1);
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1);
}
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

3
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -4,6 +4,7 @@ package com.fr.design.file;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.imenu.UIMenuItem;
@ -753,7 +754,7 @@ public class MutilTempalteTabPane extends JComponent {
/**
* 关闭掉一个模板之后激活新的待显示模板
*/
private void activePrevTemplateAfterClose() {
public void activePrevTemplateAfterClose() {
if (openedTemplate.isEmpty()) {
//新建并激活模板
DesignerContext.getDesignerFrame().addAndActivateJTemplate();

3
designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java

@ -16,4 +16,7 @@ public interface ChartEditPaneProvider {
default void removeChartEditPaneActionListener(ChartEditPaneActionListener l) {
}
default void resetLastChartCollection() {
}
}

7
designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java

@ -1,12 +1,11 @@
package com.fr.design.gui.itextfield;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
/**

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

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.chartx.TwoTuple;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -35,6 +36,8 @@ import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
@ -78,6 +81,8 @@ import java.util.Set;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange {
public static final Event<TwoTuple<String, String>> TEMPLATE_RENAME = new Event<TwoTuple<String, String>>() {
};
private static final String FILE = "file";
private static volatile DesignerFrameFileDealerPane THIS;
@ -690,6 +695,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
boolean success = selectedOperation.rename(fnf, path, newPath);
if (success) {
EventDispatcher.fire(TEMPLATE_RENAME, new TwoTuple<>(path, newPath));
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath);
selectedOperation.refresh();

5
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -86,7 +86,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
} else if (jt.isOpening()) {
showOpenStatus();
} else if (jt.isOpenFailed()) {
showOpenFailedCover();
showOpenFailedCover(jt.getTemplateOpenFailedTip());
} else {
hideCover();
}
@ -115,7 +115,8 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
layeredPane.moveToFront(loadingPane);
}
public void showOpenFailedCover() {
public void showOpenFailedCover(String text) {
failedPane.setFailedTip(text);
layeredPane.moveToFront(failedPane);
}

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

@ -114,6 +114,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private JComponent centerPane;
private DesignModelAdapter<T, ?> designModel;
private PreviewProvider previewType;
private String templateOpenFailedTip;
/**
* 统计模板制作耗时
*
@ -877,7 +879,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
protected boolean export() throws Exception {
return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE));
return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE()));
}
@ -1051,35 +1053,49 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
/**
* 判断是否是新版设计器
*
* @param showTipPane 是否需要展示弹窗
* @return 是返回true
*/
public boolean isNewDesigner() {
public boolean isNewDesigner(boolean showTipPane) {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
if (isLowerThanHBB(xmlDesignerVersion)) {
String info = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open-New_Form_Tip");
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
if (showTipPane) {
new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
}
return true;
}
return false;
}
public boolean isNewDesigner() {
return isNewDesigner(true);
}
/**
* 是否是就版本设计器
*
* @param showTipPane 是否需要展示弹窗
* @return 是就返回true
*/
public boolean isOldDesigner() {
public boolean isOldDesigner(boolean showTipPane) {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
if (isHigherThanCurrent(xmlDesignerVersion)) {
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion));
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
if (showTipPane) {
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
}
return true;
}
return false;
}
public boolean isOldDesigner() {
return isOldDesigner(true);
}
/**
*
*/
@ -1460,7 +1476,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (editingFILE == null || editingFILE instanceof MemFILE) {
return false;
}
this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE));
export();
this.editingFILE = editingFILE;
return true;
}
@ -1628,4 +1644,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public String getRuntimeId() {
return runtimeId;
}
public String getTemplateOpenFailedTip() {
return templateOpenFailedTip;
}
public void setTemplateOpenFailedTip(String templateOpenFailedTip) {
this.templateOpenFailedTip = templateOpenFailedTip;
}
}

10
designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java

@ -24,6 +24,7 @@ public class OpenFailedPane extends JPanel {
private UILabel label;
private MessageWithLink link;
private String defaultFailedText;
public OpenFailedPane() {
this.setLayout(new LayoutManager() {
@ -83,11 +84,18 @@ public class OpenFailedPane extends JPanel {
});
}
};
this.defaultFailedText = link.getText();
link.setBackground(Color.WHITE);
this.add(label);
this.add(link);
}
public void setFailedTip(String text) {
if (StringUtils.isEmpty(text)) {
this.link.setText(defaultFailedText);
} else {
this.link.setText(text);
}
}
}

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

@ -40,6 +40,7 @@ import com.fr.design.actions.server.GlobalParameterAction;
import com.fr.design.actions.server.GlobalTableDataAction;
import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
@ -407,7 +408,9 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new OpenRecentReportMenuDef());
addCloseCurrentTemplateAction(menuDef);
if (!DesignModeContext.isDuchampMode()) {
addCloseCurrentTemplateAction(menuDef);
}
scs = plus.shortcut4FileMenu();
if (!ArrayUtils.isEmpty(scs)) {
@ -491,10 +494,12 @@ public abstract class ToolBarMenuDock {
if (!DesignerMode.isAuthorityEditing()) {
addPluginManagerAction(menuDef);
menuDef.addShortCut(
new FunctionManagerAction(),
new GlobalParameterAction()
);
menuDef.addShortCut(new FunctionManagerAction());
if (!DesignModeContext.isDuchampMode()) {
menuDef.addShortCut(new GlobalParameterAction());
}
}

228
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -0,0 +1,228 @@
package com.fr.design.report.fit;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.report.fit.menupane.FitPreviewPane;
import com.fr.design.report.fit.menupane.FitRadioGroup;
import com.fr.design.report.fit.menupane.FontRadioGroup;
import com.fr.design.report.fit.provider.FitAttrModelProvider;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.report.fit.ReportFitAttr;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Set;
import java.util.stream.Collectors;
import static com.fr.design.i18n.Toolkit.i18nText;
public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected JPanel contentJPanel;
protected UIComboBox itemChoose;
protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>();
public FontRadioGroup fontRadioGroup;
public FitRadioGroup adaptRadioGroup;
public JPanel attrJPanel;
public FitPreviewPane previewJPanel;
public FitAttrModel fitAttrModel;
protected BaseFitAttrPane() {
initFitAttrModel();
}
private void initFitAttrModel() {
fitAttrModelList.add(new FrmFitAttrModel());
fitAttrModelList.add(new CptFitAttrModel());
Set<FitAttrModelProvider> fitAttrModelProviders = ExtraDesignClassManager.getInstance().getArray(FitAttrModelProvider.XML_TAG);
for (FitAttrModelProvider fitAttrModelProvider : fitAttrModelProviders) {
fitAttrModelList.add(fitAttrModelProvider);
}
fitAttrModelList = fitAttrModelList.stream().sorted(Comparator.comparing(FitAttrModel::getPriority).reversed()).collect(Collectors.toList());
}
protected void populateModel(FitAttrModel fitAttrModel) {
this.fitAttrModel = fitAttrModel;
if (attrJPanel != null) {
contentJPanel.remove(attrJPanel);
}
if (previewJPanel != null) {
contentJPanel.remove(previewJPanel);
}
fontRadioGroup = new FontRadioGroup();
adaptRadioGroup = new FitRadioGroup();
initAttrJPanel();
initPreviewJPanel();
}
protected void initAttrJPanel() {
int colCount = fitAttrModel.getFitTypes().length + 1;
Component[][] components = new Component[2][colCount];
initFitRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, components[0]);
initFitRadioGroup(adaptRadioGroup, fitAttrModel.getFitName(), Arrays.stream(fitAttrModel.getFitTypes()).map(FitType::description).toArray(String[]::new), components[1]);
double[] rowSize = new double[2];
double[] columnSize = new double[colCount];
for (int i = 0; i < rowSize.length; i++) {
rowSize[i] = 20;
}
for (int i = 0; i < columnSize.length; i++) {
if (i == 0) {
columnSize[i] = 80;
} else {
columnSize[i] = 100;
}
}
attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100));
contentJPanel.add(attrJPanel);
}
private void initFitRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) {
components[0] = new UILabel(name);
for (int i = 0; i < options.length; i++) {
if (options[i] != null) {
UIRadioButton fontFitRadio = new UIRadioButton(options[i]);
fitRadioGroup.add(fontFitRadio);
components[i + 1] = fontFitRadio;
} else {
components[i + 1] = null;
}
}
fitRadioGroup.addActionListener(getPreviewActionListener());
}
protected ActionListener getPreviewActionListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshPreviewJPanel();
}
};
}
protected void refreshPreviewJPanel() {
String previewIndex = getPreviewIndex();
previewJPanel.refreshPreview(previewIndex, fontRadioGroup.isEnabled());
}
protected String getPreviewIndex() {
return getStateInPC(adaptRadioGroup.getSelectRadioIndex()) + "" + fontRadioGroup.getSelectRadioIndex();
}
protected void initPreviewJPanel() {
previewJPanel = new FitPreviewPane();
contentJPanel.add(previewJPanel);
}
protected int getStateInPC(int index) {
FitType[] fitTypes = fitAttrModel.getFitTypes();
return fitTypes[index].getState();
}
protected int getOptionIndex(int state) {
FitType[] fitTypes = fitAttrModel.getFitTypes();
for (int i = 0; i < fitTypes.length; i++) {
if (ComparatorUtils.equals(state, fitTypes[i].getState())) {
return i;
}
}
return 0;
}
@Override
public void populateBean(ReportFitAttr ob) {
fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1);
adaptRadioGroup.selectIndexButton(getOptionIndex(ob.fitStateInPC()));
refreshPreviewJPanel();
}
@Override
public ReportFitAttr updateBean() {
ReportFitAttr reportFitAttr = new ReportFitAttr();
reportFitAttr.setFitFont(fontRadioGroup.isFontFit());
reportFitAttr.setFitStateInPC(getStateInPC(adaptRadioGroup.getSelectRadioIndex()));
return reportFitAttr;
}
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
fontRadioGroup.setEnabled(enabled);
adaptRadioGroup.setEnabled(enabled);
refreshPreviewJPanel();
}
@Override
protected String title4PopupWindow() {
return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
protected abstract String[] getItemNames();
protected void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentJPanel = new JPanel();
contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout());
this.add(contentJPanel);
initItemChoose();
}
private void initItemChoose() {
JPanel chooseJPanel = new JPanel();
chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
ItemListener itemListener = getItemListener();
itemChoose = new UIComboBox(getItemNames());
itemChoose.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{
belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0);
chooseJPanel.add(buttonPane);
chooseJPanel.setPreferredSize(new Dimension(500, 50));
JPanel jPanel = new JPanel();
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel.add(chooseJPanel, BorderLayout.WEST);
contentJPanel.add(jPanel);
}
protected abstract ItemListener getItemListener();
public void populate(ReportFitAttr reportFitAttr) {
}
protected void refresh() {
validate();
repaint();
revalidate();
}
}

51
designer-base/src/main/java/com/fr/design/report/fit/CptFitAttrModel.java

@ -0,0 +1,51 @@
package com.fr.design.report.fit;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.report.fit.ReportFitAttr;
import com.fr.report.fit.ReportFitConfig;
public class CptFitAttrModel implements FitAttrModel {
@Override
public FitType[] getFitTypes() {
return new FitType[]{
FitType.HORIZONTAL_FIT,
FitType.DOUBLE_FIT,
FitType.NOT_FIT
};
}
@Override
public String getFitName() {
return Toolkit.i18nText("Fine-Designer_Fit-Element");
}
@Override
public String getModelName() {
return Toolkit.i18nText("Fine-Design_Basic_Plain_Report");
}
@Override
public ReportFitAttr getGlobalReportFitAttr() {
return ReportFitConfig.getInstance().getCptFitAttr();
}
@Override
public void setGlobalReportFitAttr(ReportFitAttr reportFitAttr) {
ReportFitConfig.getInstance().setCptFitAttr(reportFitAttr);
}
@Override
public int getPriority() {
return 0;
}
@Override
public boolean isAvailable(JTemplate jTemplate) {
return jTemplate.isJWorkBook();
}
}

44
designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java

@ -0,0 +1,44 @@
package com.fr.design.report.fit;
import com.fr.design.mainframe.JTemplate;
import com.fr.report.fit.ReportFitAttr;
public interface FitAttrModel {
/**
* @Description 名称比如普通报表决策报表等
**/
String getModelName();
/**
* @Description 自适应选项的名称比如返回表格
**/
String getFitName();
/**
* @Description 自适应选项
**/
FitType[] getFitTypes();
/**
* @Description 获取全局的自适应属性
**/
ReportFitAttr getGlobalReportFitAttr();
/**
* @Description 设置全局的自适应属性
* @param: reportFitAttr
**/
void setGlobalReportFitAttr(ReportFitAttr reportFitAttr);
/**
* @Description 优先级
**/
int getPriority();
/**
* @Description 是否可用
* @param: jTemplate
**/
boolean isAvailable(JTemplate jTemplate);
}

53
designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java

@ -0,0 +1,53 @@
package com.fr.design.report.fit;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.report.fit.ReportFitAttr;
import com.fr.report.fit.ReportFitConfig;
public class FrmFitAttrModel implements FitAttrModel {
@Override
public String getModelName() {
return Toolkit.i18nText("Fine-Design_Basic_Decision_Report");
}
@Override
public String getFitName() {
return Toolkit.i18nText("Fine-Designer_Fit-Element");
}
public FitType[] getFitTypes() {
return new FitType[]{
FitType.DEFAULT,
FitType.HORIZONTAL_FIT,
FitType.DOUBLE_FIT,
FitType.NOT_FIT
};
}
@Override
public ReportFitAttr getGlobalReportFitAttr() {
return ReportFitConfig.getInstance().getFrmFitAttr();
}
@Override
public void setGlobalReportFitAttr(ReportFitAttr reportFitAttr) {
ReportFitConfig.getInstance().setFrmFitAttr(reportFitAttr);
}
@Override
public int getPriority() {
return 1;
}
@Override
public boolean isAvailable(JTemplate jTemplate) {
return !jTemplate.isJWorkBook();
}
}

10
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -1,6 +1,5 @@
package com.fr.design.report.fit.menupane;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -82,13 +81,8 @@ public class ReportFitAttrAction extends JTemplateAction {
}
final FitProvider wbTpl = (FitProvider) jwb.getTarget();
ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
if (jwb.isJWorkBook()) {
final TemplateFitAttrPane attrPane = new TemplateFitAttrPane();
showReportFitDialog(fitAttr, jwb, wbTpl, attrPane);
} else {
final ReportFitAttrPane attrPane = new ReportFitAttrPane();
showReportFitDialog(fitAttr, jwb, wbTpl, attrPane);
}
TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane(jwb);
showReportFitDialog(fitAttr, jwb, wbTpl, templateFitAttrPane);
}
private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {

107
designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java

@ -1,55 +1,92 @@
package com.fr.design.report.fit.menupane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.report.fit.BaseFitAttrPane;
import com.fr.design.report.fit.FitAttrModel;
import com.fr.general.ComparatorUtils;
import com.fr.report.fit.FitProvider;
import com.fr.report.fit.ReportFitAttr;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* Created by 夏翔 on 2016/6/24.
*/
public class TemplateFitAttrPane extends BasicBeanPane<ReportFitAttr> {
private TemplateBrowserFitAttrPane attrPane;
public class TemplateFitAttrPane extends BaseFitAttrPane {
public TemplateFitAttrPane() {
private JTemplate jwb;
public TemplateFitAttrPane(JTemplate jwb) {
this.jwb = jwb;
initComponents();
}
private void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
attrPane = new TemplateBrowserFitAttrPane();
this.add(attrPane);
@Override
protected void initComponents() {
super.initComponents();
for (FitAttrModel fitAttrModel : fitAttrModelList) {
if (fitAttrModel.isAvailable(jwb)) {
populateModel(fitAttrModel);
break;
}
}
}
@Override
public void populateBean(ReportFitAttr reportFitAttr) {
if (reportFitAttr == null) {
itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings"));
} else {
itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"));
}
populate(reportFitAttr);
}
/**
* 展示界面
*
* @param fitAttr 自适应属性
*/
public void populateBean(ReportFitAttr fitAttr) {
attrPane.populateBean(fitAttr);
public void populate(ReportFitAttr reportFitAttr) {
if (reportFitAttr == null) {
reportFitAttr = fitAttrModel.getGlobalReportFitAttr();
}
super.setEnabled(isTemplateSingleSet());
super.populateBean(reportFitAttr);
}
/**
* 提交数据
*
* @return 界面上的更新数据
*/
public ReportFitAttr updateBean() {
return attrPane.updateBean();
if (!isTemplateSingleSet()) {
return null;
} else {
return super.updateBean();
}
}
@Override
protected String[] getItemNames() {
return new String[]{Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings"),
Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")};
}
@Override
protected ItemListener getItemListener() {
return new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if(isTemplateSingleSet()){
if (jwb != null) {
FitProvider wbTpl = (FitProvider) jwb.getTarget();
ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
populate(fitAttr);
}
}else {
populate(fitAttrModel.getGlobalReportFitAttr());
}
}
}
};
}
/**
* 标题
*
* @return 标题
*/
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Fit_Attr");
private boolean isTemplateSingleSet() {
return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), itemChoose.getSelectedItem());
}
}
}

18
designer-base/src/main/java/com/fr/design/report/fit/provider/AbstractFitAttrModelProvider.java

@ -0,0 +1,18 @@
package com.fr.design.report.fit.provider;
import com.fr.stable.fun.mark.API;
@API(level = FitAttrModelProvider.CURRENT_LEVEL)
public abstract class AbstractFitAttrModelProvider implements FitAttrModelProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

11
designer-base/src/main/java/com/fr/design/report/fit/provider/FitAttrModelProvider.java

@ -0,0 +1,11 @@
package com.fr.design.report.fit.provider;
import com.fr.design.report.fit.FitAttrModel;
import com.fr.stable.fun.mark.Mutable;
public interface FitAttrModelProvider extends Mutable, FitAttrModel {
String XML_TAG = "FitAttrModelProvider";
int CURRENT_LEVEL = 1;
}

42
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -17,15 +17,17 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
import com.teamdev.jxbrowser.event.Observer;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.Map;
/**
* @author richie
@ -157,6 +159,38 @@ public class ModernUIPane<T> extends BasicPane {
return null;
}
public void disposeBrowser() {
if(browser != null) {
browser.dispose();
browser = null;
}
}
public void clearCache() {
if (browser != null) {
browser.getCacheStorage().clearCache();
File file = new File(browser.getContext().getCacheDir());
if (file.exists()) {
file.delete();
}
}
}
public void executeJavaScript(String javaScript) {
if (browser != null) {
browser.executeJavaScript(javaScript);
}
}
public JSValue executeJavaScriptAndReturnValue(String javaScript) {
if (browser != null) {
return browser.executeJavaScriptAndReturnValue(javaScript);
}
return null;
}
public static class Builder<T> implements BuilderDiff<T> {
private ModernUIPane<T> pane;
@ -293,6 +327,12 @@ public class ModernUIPane<T> extends BasicPane {
return this;
}
@Override
public Builder<T> prepareForV7(Class event, Observer listener) {
// do nothing
return this;
}
public ModernUIPane<T> build() {
return pane;
}

2
designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java

@ -4,6 +4,7 @@ import com.fr.design.ui.ModernUIPane;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.event.Observer;
/**
* 封装jxbrwoser v6/v7的构建方式的差异
@ -20,5 +21,6 @@ public interface BuilderDiff<T> {
ModernUIPane.Builder<T> prepareForV7(InjectJsCallback callback);
ModernUIPane.Builder<T> prepareForV7(Class event, Observer listener);
}

19
designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java

@ -11,6 +11,17 @@ import com.fr.stable.os.OperatingSystem;
public class ModernUIPaneFactory {
public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() {
if (isV7()) {
return new NewModernUIPane.Builder<>();
} else {
return new ModernUIPane.Builder<>();
}
}
public static boolean isV7() {
// 7.15的class不存在时 走老版本
boolean hasJxBrowserV7_15 = true;
try {
@ -18,10 +29,8 @@ public class ModernUIPaneFactory {
} catch (ClassNotFoundException e) {
hasJxBrowserV7_15 = false;
}
if (OperatingSystem.isWindows() && hasJxBrowserV7_15) {
return new NewModernUIPane.Builder<>();
} else {
return new ModernUIPane.Builder<>();
}
return OperatingSystem.isWindows() && hasJxBrowserV7_15;
}
}

57
designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

@ -15,6 +15,7 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.engine.EngineOptions;
import com.teamdev.jxbrowser.engine.RenderingMode;
import com.teamdev.jxbrowser.event.Observer;
import com.teamdev.jxbrowser.js.JsObject;
import com.teamdev.jxbrowser.net.Scheme;
import com.teamdev.jxbrowser.view.swing.BrowserView;
@ -80,30 +81,33 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
private void showDebuggerDialog() {
JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this));
Engine engine = Engine.newInstance(
EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED)
.addSwitch("--disable-google-traffic")
.remoteDebuggingPort(9222).build());
Browser debugger = engine.newBrowser();
Browser debugger = browser.engine().newBrowser();
BrowserView debuggerView = BrowserView.newInstance(debugger);
dialog.add(debuggerView, BorderLayout.CENTER);
dialog.setSize(new Dimension(800, 400));
GUICoreUtils.centerWindow(dialog);
dialog.setVisible(true);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
browser.devTools().remoteDebuggingUrl().ifPresent(url -> {
debugger.navigation().loadUrl(url);
});
}
private void initializeBrowser() {
EngineOptions options;
EngineOptions.Builder builder;
if (scheme != null && requestCallback != null) {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback).build();
} else {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build();
builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback);
} else {
builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic");
}
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
builder.remoteDebuggingPort(9222);
}
Engine engine = Engine.newInstance(options);
Engine engine = Engine.newInstance(builder.build());
browser = engine.newBrowser();
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的
@ -161,6 +165,29 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
return null;
}
public void disposeBrowser() {
if (browser != null) {
browser.close();
browser = null;
}
}
public void clearCache() {
if (browser != null) {
browser.engine().httpCache().clear();
}
}
public void executeJavaScript(String javaScript) {
if (browser != null) {
browser.mainFrame().ifPresent(frame -> {
frame.executeJavaScript(javaScript);
});
}
}
public static class Builder<T> extends ModernUIPane.Builder<T> {
private NewModernUIPane<T> pane = new NewModernUIPane<>();
@ -191,7 +218,7 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
@Override
public NewModernUIPane.Builder<T> withURL(final String url) {
pane.scheme = Scheme.of("file");
pane.requestCallback = new NxComplexInterceptRequestCallback(null);
pane.requestCallback = new NxComplexInterceptRequestCallback(null);
pane.browser.navigation().loadUrl(url);
return this;
}
@ -301,6 +328,14 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
return prepare(callback);
}
@Override
public ModernUIPane.Builder<T> prepareForV7(Class event, Observer listener) {
pane.browser.navigation().on(event, listener);
return this;
}
@Override
public NewModernUIPane<T> build() {
return pane;

46
designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java

@ -0,0 +1,46 @@
package com.fr.design.utils.gui;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import java.awt.Color;
/**
* @author shine
* @version 10.0
* Created by shine on 2021/9/6
*/
public class AdjustWorkBookDefaultStyleUtils {
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110);
public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle();
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
style = style.deriveBorder(0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER);
cellElement.setStyle(style);
}
}
public static void adjustFloatElement(FloatElement floatElement) {
if (DesignModeContext.isDuchampMode()) {
Style style = floatElement.getStyle();
style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND));
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
floatElement.setStyle(style);
}
}
public static Color adjustBack(Color color) {
return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color;
}
}

8
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -38,7 +38,6 @@ import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
import java.awt.Container;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.BorderFactory;
@ -67,10 +66,13 @@ import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Point;
@ -82,8 +84,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -176,7 +176,7 @@ public final class GUICoreUtils {
if (style.getBackground() instanceof ColorBackground) {
textField.setBackground(((ColorBackground) style.getBackground()).getColor());
} else {
textField.setBackground(Color.WHITE);
textField.setBackground(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE));
}
}

25
designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java

@ -7,12 +7,14 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.design.worker.WorkerManager;
import com.fr.exception.DecryptTemplateException;
import com.fr.file.FILE;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
@ -61,7 +63,7 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
} catch (CancellationException ignored) {
return;
} catch (Throwable t) {
processFailed();
processFailed(StringUtils.EMPTY);
Throwable cause = t.getCause();
if (cause instanceof DecryptTemplateException) {
FineJOptionPane.showMessageDialog(
@ -91,6 +93,11 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
if (slowly && templateCallable != null) {
try {
JTemplate<?, ?> book = templateCallable.call();
if (inValidDesigner(book)) {
String text = Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(book.getTarget().getDesignerVersion()));
processFailed(text);
return;
}
FILE tplFile = book.getEditingFILE();
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
// 当前tab页是正在打开的模板
@ -117,11 +124,21 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
WorkerManager.getInstance().removeWorker(taskName);
}
private void processFailed() {
private boolean inValidDesigner(JTemplate<?, ?> jt) {
return jt.isOldDesigner(false) || (!jt.isJWorkBook() && jt.isNewDesigner(false));
}
private void processFailed(String text) {
this.template.setOpenFailed(true);
this.template.setOpening(false);
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover();
DesignerFrameFileDealerPane.getInstance().stateChange();
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
// 需要判断当前打开的模板是不是异步执行后失败的模板 是的话立即展示失败后的提示内容 否则只设置下失败的提示内容
if (ComparatorUtils.equals(currentTemplate.getEditingFILE().getName(), this.template.getName())) {
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover(text);
DesignerFrameFileDealerPane.getInstance().stateChange();
} else {
this.template.setTemplateOpenFailedTip(text);
}
WorkerManager.getInstance().removeWorker(taskName);
}

8
designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java

@ -13,6 +13,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.stable.ListMap;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
@ -115,7 +116,12 @@ public abstract class CustomJobPane extends BasicBeanPane {
@Override
public void populateBean(Object ob) {
if (ob instanceof AbstractClassJob) {
if (ob == null) {
// 自定义提交新增时初始化页面 REPORT-59256
this.classNameTextField.setText(StringUtils.EMPTY);
this.objectProperiesPane.populateBean(new ListMap());
}
else if (ob instanceof AbstractClassJob) {
AbstractClassJob cj = (AbstractClassJob) ob;
this.classNameTextField.setText(cj.getClassName());
this.objectProperiesPane.populateBean(cj.getPropertyMap());

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

@ -29,6 +29,9 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.file.filetree.FileNode;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.file.filter.FILEFilter;
@ -45,6 +48,8 @@ import com.fr.stable.os.windows.WindowsDetector;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import javax.swing.AbstractAction;
import javax.swing.AbstractListModel;
import javax.swing.ActionMap;
@ -66,7 +71,6 @@ import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
@ -1325,6 +1329,12 @@ public class FILEChooserPane extends BasicPane {
LocationButtonPane.this.repaint(10);
}
});
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
setPopDir(null);
}
});
}
public void highLightButton(FILE dir) {

2
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -149,7 +149,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public static WidgetOption[] initWidgetOption() {
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
String[] chartIDs = ChartTypeManager.getInstance().getChartIDs4Create();
ChartWidgetOption[] child = new ChartWidgetOption[chartIDs.length];
int index = 0;

2
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -31,7 +31,7 @@ import java.awt.Component;
public class ChartTypePane extends ChartCommonWizardPane implements CallbackEvent {
private static final long serialVersionUID = -1175602484968520546L;
private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs();
private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getChartIDs4Create();
private JList mainTypeList = null;
private JList iconViewList = null;

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

@ -55,6 +55,8 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
chartEditPane.setContainer(container);
currentID = plotID;
resetChartEditPane();
} else {
chartEditPane.resetLastChartCollection();
}
}

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -118,6 +118,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
this.listenerList.remove(ChartEditPaneActionListener.class, l);
}
public void resetLastChartCollection() {
this.lastCollection = null;
}
private void fireAttributeChange(ChartCollection chartCollection) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -4,6 +4,7 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -18,6 +19,7 @@ import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox;
import com.fr.design.mainframe.chart.gui.item.ItemEventType;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.mainframe.chart.mode.ChartEditMode;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
@ -173,7 +175,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
Map<Integer, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane,
ActionListener autoButtonListener) {
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDsIncludeDisabled();
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
for (String id : chartIDs) {
@ -288,7 +290,9 @@ public class ChartTypePane extends AbstractChartAttrPane {
Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>> entry = iterator.next();
String plotID = entry.getKey();
if (ignore || ChartTypeManager.enabledChart(plotID)) {
cards.add(entry.getValue());
if (ChartTypeManager.getInstance().isShowInDesigner(plotID)) {
cards.add(entry.getValue());
}
}
}
@ -310,7 +314,9 @@ public class ChartTypePane extends AbstractChartAttrPane {
//第一步就是重构cards
cards.clear();
if (enabledChart) {
if (ChartEditContext.duchampMode()) {
addOnePlotIDCards(priority, chartID);
} else if (enabledChart) {
if (collection.getChartCount() == 1) {
addAllCards();
} else {

3
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java

@ -44,6 +44,9 @@ public class VanChartCustomInteractivePane extends VanChartInteractivePane {
@Override
protected void updateHyperlink(Plot plot){
if (hyperlinkPane == null) {
return;
}
hyperlinkPane.updateBean(chart);
}

18
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -471,7 +471,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
}
protected Component[][] createToolBarComponents() {
return new Component[][]{
return ChartEditContext.duchampMode() ? new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), isSort},
new Component[]{null, fullScreenDisplay},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse},
} : new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), isSort},
new Component[]{null, exportImages},
new Component[]{null, fullScreenDisplay},
@ -480,7 +484,10 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
}
protected Component[][] createToolBarComponentsWithOutSort() {
return new Component[][]{
return ChartEditContext.duchampMode() ? new Component[][]{
new Component[]{null, fullScreenDisplay},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse}
} : new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), exportImages},
new Component[]{null, fullScreenDisplay},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse}
@ -685,7 +692,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
}
protected void updateHyperlink(Plot plot) {
superLink.update(plot);
if (superLink != null) {
superLink.update(plot);
}
}
private void updateChartTools(VanChart chart) {
@ -734,6 +743,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private void updateAutoRefresh(VanChart chart) {
if (autoRefreshPane == null) {
return;
}
RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel();
if (refreshMoreLabel == null) {

7
designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java

@ -101,7 +101,12 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p, p, p, p};
Component[][] components = new Component[][]{
Component[][] components = ChartEditContext.duchampMode() ? new Component[][]{
new Component[]{null},
new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)},
new Component[]{backgroundPane},
new Component[]{selectBackgroundPane}
} : new Component[][]{
new Component[]{null},
new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)},
new Component[]{backgroundPane},

5
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -16,6 +16,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithMaxMin;
import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.GaugeDetailStyle;
@ -199,7 +200,9 @@ public class VanChartGaugeSeriesPane extends VanChartMultiColorSeriesPane {
if (attrLabelDetail == null || attrLabelDetail.getTextAttr() == null) {
return;
}
attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT);
if (!ChartEditContext.duchampMode()) {
attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT);
}
if (gaugeLayout.getSelectedIndex() == 0) {
attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT);
attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT);

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java

@ -35,6 +35,9 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo
@Override
protected void updateHyperlink(Plot plot) {
if (hyperlinkPane == null) {
return;
}
hyperlinkPane.updateBean(plot);
}

18
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -104,6 +104,15 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
refreshStylePreviewEffect();
}
/**
* @deprecated 该方法在样式数据模型发生变化如主题更新/body布局类型切换等均会被调用并不仅限于初始化
* 因此原方法名称废弃不应当被继续使用
* @link {{@link #refreshStylePreviewEffect()}}
*/
protected void initStyle() {
refreshStylePreviewEffect();
}
public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
refreshBorderAndBackgroundStylePreviewEffect();
@ -117,6 +126,15 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
reshuffleBorderAndBackgroundPaintingEffectIfTitleExists();
}
/**
* @deprecated 该方法在样式数据模型发生变化如主题更新/图表默认开启标题等时均会被调用并不仅限于初始化
* 因此原方法名称废弃不应当被继续使用
* @link {{@link #refreshBorderAndBackgroundStylePreviewEffect()} ()}}
*/
protected void initBorderAndBackgroundStyle() {
refreshBorderAndBackgroundStylePreviewEffect();
}
public void refreshBorderAndBackgroundStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER;

47
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

@ -22,6 +22,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
import com.fr.general.Background;
@ -30,11 +31,23 @@ import com.fr.general.IOUtils;
import com.fr.general.act.TitlePacker;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Stroke;
/**
* @author Starryi
@ -145,16 +158,16 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
double[] rowSize = supportCornerRadius ? new double[] {p, p, p, p} : new double[]{p, p, p};
double[] columnSize = {SETTING_LABEL_WIDTH, f};
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style"));
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style"));
Font font = uiLabel.getFont().deriveFont(Font.BOLD);
uiLabel.setFont(font);
uiLabel.setForeground(new Color(143, 143, 146));
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{uiLabel, null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo},
{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), createBorderLayoutNorthPaneWithComponent(borderStyleCombo)},
{this.borderLineAndImagePane, null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner},
{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner},
},
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
@ -180,7 +193,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
this.backgroundPane,
this.backgroundOpacityPane);
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content"));
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content"));
Font font = uiLabel.getFont().deriveFont(Font.BOLD);
uiLabel.setFont(font);
uiLabel.setForeground(new Color(143, 143, 146));
@ -297,11 +310,11 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
double[] columnSize = {SETTING_LABEL_WIDTH, f};
final JPanel bottomPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content")), titleTextPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Format")), titleFontFamilyComboBox},
{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content")), titleTextPane},
{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Format")), createBorderLayoutNorthPaneWithComponent(titleFontFamilyComboBox)},
{null, createTitleFontButtonPane()},
{titleInsetImagePane, null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Text_Align")), titleAlignPane},
{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Text_Align")), titleAlignPane},
{this.createTitleBackgroundAndOpacityPane(), null},
},
rowSize, columnSize, IntervalConstants.INTERVAL_L1);
@ -312,9 +325,9 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
titleVisibleCheckbox.setSelected(false);
visibleComposedPane.add(titleVisibleCheckbox, BorderLayout.WEST);
visibleComposedPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Visible")), BorderLayout.CENTER);
visibleComposedPane.add(FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Visible")), BorderLayout.CENTER);
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title"));
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title"));
Font font = uiLabel.getFont().deriveFont(Font.BOLD);
uiLabel.setFont(font);
uiLabel.setForeground(new Color(143, 143, 146));
@ -339,6 +352,12 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
return container;
}
private JPanel createBorderLayoutNorthPaneWithComponent(JComponent content) {
JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(content, BorderLayout.NORTH);
return jPanel;
}
protected JPanel createTitleFontButtonPane(){
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -511,8 +530,8 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
// 确保BackgroundSpecialPane高度变化时,Label依然保持与其顶部对齐
JPanel backgroundLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
backgroundLabelPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
backgroundLabelPane.add(new UILabel(name), BorderLayout.NORTH);
backgroundLabelPane.setBorder(BorderFactory.createEmptyBorder(7, 0, 0, 0));
backgroundLabelPane.add(FRWidgetFactory.createLineWrapLabel(name), BorderLayout.NORTH);
JPanel backgroundComposedPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{
@ -522,7 +541,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
JPanel opacityComposedPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{
{new UILabel(""), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))},
{new UILabel(""), FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))},
{new UILabel(""), opacityPane}
},
new double[]{p, p}, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);

6
designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.BaseFormula;
import com.fr.base.DynamicUnitList;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
@ -15,7 +14,7 @@ import com.fr.design.formula.UIFormula;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
@ -23,7 +22,7 @@ import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
import javax.swing.KeyStroke;
/**
* Insert formula.
@ -100,6 +99,7 @@ public class FormulaFloatAction extends ElementCaseAction {
reportPane.stopEditing();
final FloatElement floatElement = new FloatElement();
AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement);
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build());

5
designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -7,7 +7,7 @@ import com.fr.base.DynamicUnitList;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
@ -15,7 +15,7 @@ import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
@ -60,6 +60,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
return;
}
FloatElement floatElement = new FloatElement("Text");
AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement);
this.startDraw(floatElement);
doWithDrawingFloatElement();
}

2
designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
@ -89,6 +90,7 @@ public class CellWidgetPropertyPane extends BasicPane {
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement);
}
this.cellElement = editCellElement;
this.populate(editCellElement);

35
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -32,19 +32,17 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager
import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.form.main.Form;
import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient;
import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook;
import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.exporter.LocalExportOperator;
import com.fr.workspace.server.exporter.TemplateExportOperator;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
@ -601,14 +599,15 @@ public class AlphaFineDialog extends UIDialog {
checkWorker();
this.showWorker = new SwingWorker<BufferedImage, Void>() {
@Override
protected BufferedImage doInBackground() {
Form form = null;
protected BufferedImage doInBackground() throws Exception {
byte[] bytes = null;
try {
form = FormIO.readForm(fileName);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportFormAsImageData(fileName);
} catch (Exception ignored) {
// 兼容下老版本
bytes = new LocalExportOperator().exportFormAsImageData(fileName);
}
return FormIO.exportFormAsImage(form);
return TemplateExportOperator.byteDataToImage(bytes);
}
@Override
@ -631,15 +630,15 @@ public class AlphaFineDialog extends UIDialog {
checkWorker();
this.showWorker = new SwingWorker<BufferedImage, Void>() {
@Override
protected BufferedImage doInBackground() {
WorkBook workBook = null;
protected BufferedImage doInBackground() throws Exception {
byte[] bytes = null;
try {
workBook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook(fileName);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportWorkBookAsImageData(fileName);
} catch (Exception ignored) {
// 兼容下老版本
bytes = new LocalExportOperator().exportWorkBookAsImageData(fileName);
}
BufferedImage bufferedImage = new ImageExporter().exportToImage(workBook);
return bufferedImage;
return TemplateExportOperator.byteDataToImage(bytes);
}
@Override

16
designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -7,10 +7,14 @@ import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.mainframe.cell.settingpane.AbstractCellAttrPane;
import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane;
import com.fr.design.mainframe.cell.settingpane.CellOtherSetPane;
import com.fr.design.mainframe.cell.settingpane.CellPresentPane;
import com.fr.design.mainframe.cell.settingpane.CellStylePane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement;
@ -18,8 +22,11 @@ import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
@ -113,6 +120,7 @@ public class CellElementEditPane extends BasicPane {
CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
//默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错
if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) {
elementCase.addCellElement((TemplateCellElement) cellElement);

2
designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java

@ -7,6 +7,7 @@ import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.NameObject;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
@ -83,6 +84,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane {
editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement);
}
SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里

35
designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java

@ -9,6 +9,7 @@ import com.fr.config.PrintConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.webattr.printsettings.GlobalNativePrintSettingPane;
import com.fr.design.webattr.printsettings.PrintSettingPane;
@ -17,6 +18,7 @@ import com.fr.report.web.WebPage;
import com.fr.report.web.WebView;
import com.fr.report.web.WebWrite;
import com.fr.web.attr.ReportWebAttr;
import com.fr.workspace.WorkContext;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -35,18 +37,20 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
private WriteToolBarPane writePane;
private ReportWebAttr webAttr;
private PrintSettingsAttrMark printSettings;
private WebCssPane cssPane;
private WebJsPane jsPane;
private ErrorTemplatePane errorTemplatePane;
private PrintSettingPane printSettingPane;
private ServerFitAttrPane serverFitAttrPane;
@Override
protected synchronized void initComponents(JPanel container) {
protected synchronized void initComponents(JPanel container) {
JPanel defaultPane = container;
defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -61,11 +65,14 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), jsPane = new WebJsPane());
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Error_Handler_Template"), errorTemplatePane = new ErrorTemplatePane());
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(new GlobalNativePrintSettingPane()));
if (WorkContext.getCurrent().isRoot()) {
tabbedPane.addTab(Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"), serverFitAttrPane = new ServerFitAttrPane());
}
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter");
}
public void populate(ServerPreferenceConfig reportServerPreferenceConfig) {
@ -78,28 +85,31 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
WebPage webPage = webAttr.getWebPage();
WebView webView = webAttr.getWebView();
WebWrite webWrite = webAttr.getWebWrite();
if(webPage != null){
if (webPage != null) {
pagePane.populateBean(webPage);
}
if(webView != null){
if (webView != null) {
viewPane.populateBean(webView);
}
if(webWrite != null){
if (webWrite != null) {
writePane.populateBean(webWrite);
}
cssPane.populate(webAttr);
jsPane.populate(webAttr);
printSettings = ReportUtils.getPrintSettingsFromServerConfig();
printSettingPane.populate(printSettings);
this.errorTemplatePane.populateBean(reportServerPreferenceConfig.getErrorTemplate());
if (serverFitAttrPane != null) {
serverFitAttrPane.populateBean(null);
}
}
/**
* Update.
*/
public void update(ServerPreferenceConfig reportServerPreferenceConfig) {
ReportWebAttr webAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
ReportWebAttr webAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
webAttr.setWebPage(pagePane.updateBean());
webAttr.setWebView(viewPane.updateBean());
webAttr.setWebWrite(writePane.updateBean());
@ -110,5 +120,8 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
PrintConfig.getInstance().setPrintSettings(printSettings);
reportServerPreferenceConfig.setErrorTemplate(this.errorTemplatePane.updateBean());
if (serverFitAttrPane != null) {
serverFitAttrPane.updateBean();
}
}
}

78
designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java

@ -0,0 +1,78 @@
package com.fr.design.webattr;
import com.fr.config.Configuration;
import com.fr.design.report.fit.BaseFitAttrPane;
import com.fr.design.report.fit.FitAttrModel;
import com.fr.general.ComparatorUtils;
import com.fr.report.fit.ReportFitAttr;
import com.fr.report.fit.ReportFitConfig;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class ServerFitAttrPane extends BaseFitAttrPane {
public ServerFitAttrPane() {
super();
initComponents();
}
@Override
protected void initComponents() {
super.initComponents();
populateModel(fitAttrModelList.get(0));
}
@Override
public void populateBean(ReportFitAttr reportFitAttr) {
reportFitAttr = fitAttrModel.getGlobalReportFitAttr();
super.populateBean(reportFitAttr);
}
public ReportFitAttr updateBean() {
ReportFitAttr reportFitAttr = super.updateBean();
Configurations.update(new Worker() {
@Override
public void run() {
fitAttrModel.setGlobalReportFitAttr(reportFitAttr);
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ReportFitConfig.class};
}
});
return null;
}
@Override
protected String[] getItemNames() {
return fitAttrModelList.stream().map(FitAttrModel::getModelName).toArray(String[]::new);
}
@Override
protected ItemListener getItemListener() {
ServerFitAttrPane self = this;
return new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
for (FitAttrModel fitAttrModel : fitAttrModelList) {
if (ComparatorUtils.equals(e.getItem(), fitAttrModel.getModelName())) {
self.populateModel(fitAttrModel);
populateBean(null);
refresh();
}
}
}
}
};
}
}

3
designer-realize/src/main/java/com/fr/grid/Grid.java

@ -18,6 +18,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.DesignOperationEvent;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.general.ComparatorUtils;
@ -873,6 +874,7 @@ public class Grid extends BaseGridComponent {
// 必须保证editingCellElement不是null。
if (editingCellElement == null) {
editingCellElement = new DefaultTemplateCellElement(column, row);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement);
}
editorComponent = getCellEditingComp();
if (editorComponent == null) {
@ -1038,6 +1040,7 @@ public class Grid extends BaseGridComponent {
if (editingCellElement == null) {
editingCellElement = new DefaultTemplateCellElement(editingColumn, editingRow);
tplEC.addCellElement(editingCellElement);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement);
}
if (setValue4EditingElement(newValue)) {
shrinkToFit(tplEC);

11
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -10,15 +10,14 @@ import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
@ -46,11 +45,11 @@ import com.fr.report.stable.ReportConstants;
import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.AssistUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils;
import com.fr.stable.unit.UNIT;
import com.fr.third.antlr.ANTLRException;
import com.fr.third.guava.collect.HashMultimap;
@ -176,7 +175,7 @@ public class GridUI extends ComponentUI {
// denny:画背景.Background
Background background = reportSettings.getBackground();
if (background != null) {
if (background != null && !DesignModeContext.isDuchampMode()) {
// denny: except the ColorBackground and ImageBackground
if (grid.isEnabled() && !(background instanceof ImageFileBackground)) {
background.paint(g2d, this.back_or_selection_rect);
@ -189,7 +188,7 @@ public class GridUI extends ComponentUI {
private void clearBackground(Graphics2D g2d, Grid grid) {
if (grid.isEnabled()) {
g2d.setPaint(Color.WHITE);
g2d.setPaint(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE));
} else {
g2d.setPaint(UIManager.getColor("control"));
}

3
designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java

@ -5,6 +5,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.data.TableDataColumn;
import com.fr.grid.Grid;
@ -251,7 +252,7 @@ public class ElementCasePaneDropTarget extends DropTargetAdapter {
cellExPandAttr.setDirection(Constants.TOP_TO_BOTTOM);
if (curCellElement == null) {
curCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow(), cs.getColumnSpan(), cs.getRowSpan(), newLinearDSColumn);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(curCellElement);
report.addCellElement(curCellElement);
} else {
// marks:直接覆盖值

2
designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java

@ -46,7 +46,7 @@ public class PolyComponentsBar extends JToolBar {
setFloatable(false);
setBackground(UIConstants.TOOLBARUI_BACKGROUND);
setLayout(FRGUIPaneFactory.create1ColumnGridLayout());
String[] iDs = ChartTypeManager.getInstance().getAllChartIDs();
String[] iDs = ChartTypeManager.getInstance().getChartIDs4Create();
int typeLen = iDs.length < MAX_BAR_NUM ? iDs.length : MAX_BAR_NUM;
serIcons = new SerIcon[typeLen + 1];
serIcons[0] = new SerIcon(

2
designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

@ -103,4 +103,4 @@ public class DesignerAppUtilsTest {
Assert.assertEquals(1, pluginMarkerAdapters1.size());
pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5","1"));
}
}
}
Loading…
Cancel
Save