Browse Source

Merge branch 'feature/x' of https://code.fineres.com/scm/~lucian.chen/design into feature/x

feature/x
lucian 3 years ago
parent
commit
f0b8a1770c
  1. 6
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 26
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  3. 14
      designer-base/src/main/java/com/fr/design/gui/frpane/TreeSettingPane.java
  4. 32
      designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java
  5. 5
      designer-base/src/main/java/com/fr/design/lock/LockInfoUtils.java
  6. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  7. 22
      designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java
  8. 38
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java
  9. 47
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java
  10. 88
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
  11. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java
  12. 7
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java
  13. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  14. 40
      designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java
  15. 11
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

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

@ -253,7 +253,11 @@ public class HistoryTemplateListCache implements CallbackEvent {
for (int i = 0; i < vCount; i++) { for (int i = 0; i < vCount; i++) {
JTemplate overTemplate = historyList.get(i); JTemplate overTemplate = historyList.get(i);
if (overTemplate.getEditingFILE().exists() && overTemplate.isALLSaved() && overTemplate != editingTemplate) { boolean replaceWithJVirtualTemplate = overTemplate.getEditingFILE().exists()
&& overTemplate.isALLSaved()
&& overTemplate != editingTemplate
&& overTemplate.checkEnable();
if (replaceWithJVirtualTemplate) {
closeVirtualSelectedReport(overTemplate); closeVirtualSelectedReport(overTemplate);
historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE())); historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE()));
} }

26
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -57,6 +57,8 @@ import java.util.Enumeration;
import java.util.Objects; import java.util.Objects;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import org.jetbrains.annotations.Nullable;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION; import static javax.swing.JOptionPane.YES_NO_OPTION;
@ -226,16 +228,17 @@ public class TemplateTreePane extends JPanel implements FileOperations {
} }
String reportPath = reportletsTree.getSelectedTemplatePath(); String reportPath = reportletsTree.getSelectedTemplatePath();
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath);
if (hasOpenedTemplate(selectedFilePath)) {
FineLoggerFactory.getLogger().info("{} has been opened in designer tab", selectedFilePath);
return;
}
String lock = node.getLock(); String lock = node.getLock();
boolean showLockInfo = LockInfoUtils.isCompatibleOperator() ? (lock != null && !lock.equals(node.getUserID())) boolean showLockInfo = LockInfoUtils.isCompatibleOperator()
|| LockInfoUtils.unableGetLockInfo()
|| WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath)
? (lock != null && !lock.equals(node.getUserID()))
: WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath);
if (showLockInfo) { if (showLockInfo) {
UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath);
node.setLock(UUID.randomUUID().toString()); node.setLock(UUID.randomUUID().toString());
// 对于开发者预览占位锁定 定位到tab中
checkDevelopForBiddenTemplate(selectedFilePath);
LockInfoDialog.show(userInfo); LockInfoDialog.show(userInfo);
return; return;
} else { } else {
@ -244,14 +247,21 @@ public class TemplateTreePane extends JPanel implements FileOperations {
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false)));
} }
private void checkDevelopForBiddenTemplate(String selectedFilePath) {
JTemplate<?, ?> template = getOpenedTemplate(selectedFilePath);
if (template != null && template.isForbidden()) {
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false)));
}
}
private boolean hasOpenedTemplate(String path) { @Nullable
private JTemplate<?, ?> getOpenedTemplate(String path) {
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) { for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) {
if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) { if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) {
return true; return template;
} }
} }
return false; return null;
} }
/** /**

14
designer-base/src/main/java/com/fr/design/gui/frpane/TreeSettingPane.java

@ -127,7 +127,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
buildBox.setSelectedIndex(1); buildBox.setSelectedIndex(1);
TableDataDictionary dictionary = treeEditor.getDictionary(); TableDataDictionary dictionary = treeEditor.getDictionary();
autoBuildPane.populate(dictionary); autoBuildPane.populate(dictionary);
} else if (treeEditor.isLayerBuild()) { } else if (treeEditor.isFastLayerBuild()) {
buildBox.setSelectedIndex(0); buildBox.setSelectedIndex(0);
java.util.List<LayerConfig> layerConfigList = treeEditor.getLayerConfigs(); java.util.List<LayerConfig> layerConfigList = treeEditor.getLayerConfigs();
LayerConfig[] layerConfigs = new LayerConfig[layerConfigList.size()]; LayerConfig[] layerConfigs = new LayerConfig[layerConfigList.size()];
@ -156,12 +156,12 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
if (buildBox.getSelectedIndex() == 1) { if (buildBox.getSelectedIndex() == 1) {
TableDataDictionary dictionary = this.autoBuildPane.update(); TableDataDictionary dictionary = this.autoBuildPane.update();
te.setAutoBuild(true); te.setAutoBuild(true);
te.setLayerBuild(false); te.setFastLayerBuild(false);
te.setDictionary(dictionary); te.setDictionary(dictionary);
te.setNodeOrDict(dictionary); te.setNodeOrDict(dictionary);
} else if (buildBox.getSelectedIndex() == 2) { } else if (buildBox.getSelectedIndex() == 2) {
te.setAutoBuild(false); te.setAutoBuild(false);
te.setLayerBuild(false); te.setFastLayerBuild(false);
NameObject no = this.controlPane.update(); NameObject no = this.controlPane.update();
if (no != null) { if (no != null) {
TreeEditor editor = (TreeEditor) no.getObject(); TreeEditor editor = (TreeEditor) no.getObject();
@ -181,7 +181,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
} else { } else {
LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject(); LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject();
te.setAutoBuild(false); te.setAutoBuild(false);
te.setLayerBuild(true); te.setFastLayerBuild(true);
te.setLayerConfigs(Arrays.asList(configs)); te.setLayerConfigs(Arrays.asList(configs));
} }
return te; return te;
@ -215,12 +215,12 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
if (buildBox.getSelectedIndex() == 1) { if (buildBox.getSelectedIndex() == 1) {
TableDataDictionary dictionary = this.autoBuildPane.update(); TableDataDictionary dictionary = this.autoBuildPane.update();
tcb.setAutoBuild(true); tcb.setAutoBuild(true);
tcb.setLayerBuild(false); tcb.setFastLayerBuild(false);
tcb.setDictionary(dictionary); tcb.setDictionary(dictionary);
tcb.setNodeOrDict(dictionary); tcb.setNodeOrDict(dictionary);
} else if (buildBox.getSelectedIndex() == 2) { } else if (buildBox.getSelectedIndex() == 2) {
tcb.setAutoBuild(false); tcb.setAutoBuild(false);
tcb.setLayerBuild(false); tcb.setFastLayerBuild(false);
NameObject no = this.controlPane.update(); NameObject no = this.controlPane.update();
if (no != null) { if (no != null) {
if (no.getObject() instanceof TreeComboBoxEditor) { if (no.getObject() instanceof TreeComboBoxEditor) {
@ -244,7 +244,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
}else { }else {
LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject(); LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject();
tcb.setAutoBuild(false); tcb.setAutoBuild(false);
tcb.setLayerBuild(true); tcb.setFastLayerBuild(true);
tcb.setLayerConfigs(Arrays.asList(configs)); tcb.setLayerConfigs(Arrays.asList(configs));
} }
return tcb; return tcb;

32
designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java

@ -6,10 +6,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.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.IOUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -24,7 +26,6 @@ import java.time.format.DateTimeFormatter;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.UIManager;
/** /**
* @author hades * @author hades
@ -39,13 +40,11 @@ public class LockInfoDialog extends JDialog {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
UILabel iconLabel = new UILabel(UIManager.getIcon("OptionPane.warningIcon"));
panel.add(iconLabel, BorderLayout.WEST);
panel.add(createContentPane(userInfo), BorderLayout.CENTER); panel.add(createContentPane(userInfo), BorderLayout.CENTER);
panel.add(createControlPane(), BorderLayout.SOUTH); panel.add(createControlPane(), BorderLayout.SOUTH);
this.getContentPane().add(panel); this.getContentPane().add(panel);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Alert")); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint"));
this.setSize(400, 180); this.setSize(400, 160);
this.setResizable(false); this.setResizable(false);
this.setModal(true); this.setModal(true);
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
@ -54,12 +53,21 @@ public class LockInfoDialog extends JDialog {
private JPanel createContentPane(UserInfo userInfo) { private JPanel createContentPane(UserInfo userInfo) {
JPanel contentPanel = new JPanel(new BorderLayout()); JPanel contentPanel = new JPanel(new BorderLayout());
contentPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0)); contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
contentPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Template_Lock_And_SaveAs_Tip")), BorderLayout.NORTH); JPanel messagePane = new JPanel(new BorderLayout(13, 0));
UILabel iconLabel = new UILabel(IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"));
iconLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
messagePane.add(iconLabel, BorderLayout.WEST);
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Template_Lock_And_SaveAs_Tip"));
tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
messagePane.add(tipLabel, BorderLayout.CENTER);
contentPanel.add(messagePane, BorderLayout.NORTH);
JPanel detailInfoPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel detailInfoPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
detailInfoPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0,0)); detailInfoPane.setBorder(BorderFactory.createEmptyBorder(0, 45, 0,0));
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getUserName())) { if (userInfo != null && StringUtils.isNotEmpty(userInfo.getUserName())) {
detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder", userInfo.getUserName()))); UILabel label = createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder", userInfo.getUserName()));
label .setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
detailInfoPane.add(label);
} }
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getIp())) { if (userInfo != null && StringUtils.isNotEmpty(userInfo.getIp())) {
detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder_Ip", userInfo.getIp()) )); detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder_Ip", userInfo.getIp()) ));
@ -72,12 +80,13 @@ public class LockInfoDialog extends JDialog {
private UILabel createLabel(String text) { private UILabel createLabel(String text) {
UILabel label = new UILabel(text); UILabel label = new UILabel(text);
label.setForeground(Color.GRAY); label.setForeground(Color.GRAY);
label.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); label.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
return label; return label;
} }
private JPanel createControlPane() { private JPanel createControlPane() {
JPanel controlPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JPanel controlPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 5));
controlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0,5));
UIButton saveAsButton = new UIButton(Toolkit.i18nText("Fine_Design_Template_Lock_Save_As")); UIButton saveAsButton = new UIButton(Toolkit.i18nText("Fine_Design_Template_Lock_Save_As"));
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")); UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel"));
saveAsButton.addActionListener(new ActionListener() { saveAsButton.addActionListener(new ActionListener() {
@ -105,6 +114,7 @@ public class LockInfoDialog extends JDialog {
public static void show(UserInfo userInfo) { public static void show(UserInfo userInfo) {
DesignerFrameFileDealerPane.getInstance().refreshRightToolBarBy(TemplateTreePane.getInstance().getFileNode());
new LockInfoDialog(userInfo); new LockInfoDialog(userInfo);
} }

5
designer-base/src/main/java/com/fr/design/lock/LockInfoUtils.java

@ -2,6 +2,7 @@ package com.fr.design.lock;
import com.fr.report.lock.DefaultLockInfoOperator; import com.fr.report.lock.DefaultLockInfoOperator;
import com.fr.report.lock.LockInfoOperator; import com.fr.report.lock.LockInfoOperator;
import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
/** /**
@ -15,4 +16,8 @@ public class LockInfoUtils {
LockInfoOperator lockInfoOperator = WorkContext.getCurrent().get(LockInfoOperator.class); LockInfoOperator lockInfoOperator = WorkContext.getCurrent().get(LockInfoOperator.class);
return lockInfoOperator instanceof DefaultLockInfoOperator; return lockInfoOperator instanceof DefaultLockInfoOperator;
} }
public static boolean unableGetLockInfo() {
return WorkContext.getCurrent().isLocal() && !FineEmbedServer.isRunning();
}
} }

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

@ -63,7 +63,6 @@ import javax.swing.JDialog;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -198,7 +197,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
rightToolBar = new UIToolbar(FlowLayout.RIGHT); rightToolBar = new UIToolbar(FlowLayout.RIGHT);
rightToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); rightToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
rightToolBar.setBorderPainted(true); rightToolBar.setBorderPainted(true);
rightToolBar.add(new UILabel(Toolkit.i18nText("Fine_Design_Template_Lock_Status"))); UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine_Design_Template_Lock_Status"));
tipLabel.setForeground(Color.GRAY);
rightToolBar.add(tipLabel);
UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/lock.png")); UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/lock.png"));
button.setRolloverIcon(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/unlock.png")); button.setRolloverIcon(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/unlock.png"));
button.setBorderPainted(false); button.setBorderPainted(false);
@ -213,7 +214,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
Toolkit.i18nText("Fine-Design_Basic_Alert"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE, JOptionPane.WARNING_MESSAGE,
UIManager.getIcon("OptionPane.warningIcon"), IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"),
new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) { if (option == JOptionPane.YES_OPTION) {
String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath()); String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath());

22
designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java

@ -14,8 +14,11 @@ import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager; import java.awt.LayoutManager;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@ -37,6 +40,7 @@ public class ForbiddenPane extends JPanel {
private static final Color BUTTON_COLOR = new Color(63, 155, 249); private static final Color BUTTON_COLOR = new Color(63, 155, 249);
private static final int Y_GAP = 10; private static final int Y_GAP = 10;
private static final int X_GAP = 10; private static final int X_GAP = 10;
private static final int ARC = 4;
private final UILabel lockLabel; private final UILabel lockLabel;
private final UILabel tipLabel; private final UILabel tipLabel;
@ -71,11 +75,11 @@ public class ForbiddenPane extends JPanel {
int tipLabelWidth = tipLabel.getPreferredSize().width; int tipLabelWidth = tipLabel.getPreferredSize().width;
int tipLabelHeight = tipLabel.getPreferredSize().height; int tipLabelHeight = tipLabel.getPreferredSize().height;
int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP; int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP;
int tipLabelY = lockLabelY + lockLabelHeight - Y_GAP; int tipLabelY = lockLabelY + lockLabelHeight;
int refreshButtonWidth = refreshButton.getPreferredSize().width; int refreshButtonWidth = refreshButton.getPreferredSize().width;
int refreshButtonHeight = refreshButton.getPreferredSize().height; int refreshButtonHeight = refreshButton.getPreferredSize().height;
int refreshButtonX = (width - refreshButtonWidth) / 2 + X_GAP; int refreshButtonX = (width - refreshButtonWidth) / 2 + X_GAP;
int refreshButtonY = tipLabelY + refreshButtonHeight; int refreshButtonY = tipLabelY + refreshButtonHeight + Y_GAP;
lockLabel.setBounds(lockLabelX, lockLabelY, lockLabelWidth, lockLabelHeight); lockLabel.setBounds(lockLabelX, lockLabelY, lockLabelWidth, lockLabelHeight);
tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight); tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight);
refreshButton.setBounds(refreshButtonX, refreshButtonY, refreshButtonWidth, refreshButtonHeight); refreshButton.setBounds(refreshButtonX, refreshButtonY, refreshButtonWidth, refreshButtonHeight);
@ -88,16 +92,20 @@ public class ForbiddenPane extends JPanel {
setBackground(Color.WHITE); setBackground(Color.WHITE);
lockLabel = new UILabel(LOCK_ICON); lockLabel = new UILabel(LOCK_ICON);
tipLabel = new UILabel(Toolkit.i18nText("Fine_Design_Template_Has_Been_Locked_Tip")); tipLabel = new UILabel(Toolkit.i18nText("Fine_Design_Template_Has_Been_Locked_Tip"));
Font labelFont = tipLabel.getFont();
tipLabel.setFont(new Font(labelFont.getName(), labelFont.getStyle(), 14));
tipLabel.setForeground(TIP_COLOR); tipLabel.setForeground(TIP_COLOR);
refreshButton = new JButton(Toolkit.i18nText("Fine-Design_Basic_Refresh")) { refreshButton = new JButton(Toolkit.i18nText("Fine-Design_Basic_Refresh")) {
@Override @Override
public void paintComponent(Graphics g) public void paintComponent(Graphics g) {
{ Graphics2D g2d = (Graphics2D) g;
g.setColor(BUTTON_COLOR); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.fillRect(0, 0, getSize().width, getSize().height); g2d.setColor(BUTTON_COLOR);
super.paintComponent(g); g2d.fillRoundRect(0, 0, getWidth(), getHeight(), ARC, ARC);
super.paintComponent(g2d);
} }
}; };
refreshButton.setPreferredSize(new Dimension(68, 24));
refreshButton.setForeground(Color.WHITE); refreshButton.setForeground(Color.WHITE);
refreshButton.setBorderPainted(false); refreshButton.setBorderPainted(false);
refreshButton.setContentAreaFilled(false); refreshButton.setContentAreaFilled(false);

38
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.theme.preview.ecpreview; package com.fr.design.mainframe.theme.preview.ecpreview;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyle;
@ -11,29 +12,6 @@ import com.fr.design.mainframe.theme.preview.ecpreview.cell.AbstractPreviewCell;
import java.util.List; import java.util.List;
public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements ThemePreviewed<TemplateTheme> { public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements ThemePreviewed<TemplateTheme> {
protected Style getReportBigTitleStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList.getUse4BigTitle());
}
protected Style getReportHeaderStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList.getUse4Header());
}
protected Style getMainContentStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList.getUse4MainText());
}
protected Style getHighLightStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList.getUse4HighlightText());
}
protected Style getSmallTitleStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList.getUse4SmallTitle());
}
protected Style getAssistMsgStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList.getUse4SupportInfo());
}
private Style getCellStyle(ThemedCellStyle themedCellStyle) { private Style getCellStyle(ThemedCellStyle themedCellStyle) {
if (themedCellStyle == null) { if (themedCellStyle == null) {
return Style.DEFAULT_STYLE; return Style.DEFAULT_STYLE;
@ -42,9 +20,19 @@ public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements T
return style != null ? style : Style.DEFAULT_STYLE; return style != null ? style : Style.DEFAULT_STYLE;
} }
protected void refresh(List<AbstractPreviewCell> list, Style style) { private CellBorderStyle getCellBorderStyle(ThemedCellStyle themedCellStyle) {
if (themedCellStyle == null) {
return null;
}
return themedCellStyle.getCellBorderStyle();
}
protected void refresh(List<AbstractPreviewCell> list, ThemedCellStyle themedCellStyle) {
Style style = getCellStyle(themedCellStyle);
CellBorderStyle borderStyle = getCellBorderStyle(themedCellStyle);
for (AbstractPreviewCell cell : list) { for (AbstractPreviewCell cell : list) {
cell.refresh(style); cell.refresh(style, borderStyle);
} }
} }

47
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.theme.preview.ecpreview; package com.fr.design.mainframe.theme.preview.ecpreview;
import com.fr.base.CellBorderSourceFlag;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -36,8 +37,16 @@ public class ECPreviewPane extends AbstractECPreviewPane {
JPanel extCenterPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel extCenterPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
this.add(extCenterPane, BorderLayout.CENTER); this.add(extCenterPane, BorderLayout.CENTER);
extCenterPane.add(titlePane, BorderLayout.NORTH); extCenterPane.add(titlePane, BorderLayout.NORTH);
for (int i = 0; i < COL_COUNT; i++) { for (int c = 0; c < COL_COUNT; c++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (c > 0) {
flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
}
if (c < COL_COUNT - 1) {
flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
cell.setBorderSourceFlag(flag);
cell.setPreferredSize(new Dimension(103, 36)); cell.setPreferredSize(new Dimension(103, 36));
titlePane.add(cell); titlePane.add(cell);
headerCellList.add(cell); headerCellList.add(cell);
@ -46,6 +55,22 @@ public class ECPreviewPane extends AbstractECPreviewPane {
extCenterPane.add(contentPane, BorderLayout.CENTER); extCenterPane.add(contentPane, BorderLayout.CENTER);
for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) { for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
int r = i / COL_COUNT;
int c = i % COL_COUNT;
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (r > 0) {
flag |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
}
if (r < CONTENT_ROW_COUNT - 1) {
flag |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
}
if (c > 0) {
flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
}
if (c < COL_COUNT - 1) {
flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
cell.setBorderSourceFlag(flag);
cell.setPreferredSize(new Dimension(103, 30)); cell.setPreferredSize(new Dimension(103, 30));
contentPane.add(cell); contentPane.add(cell);
contentCellList.add(cell); contentCellList.add(cell);
@ -53,8 +78,16 @@ public class ECPreviewPane extends AbstractECPreviewPane {
JPanel endPane = new UINoOpaquePanel(new GridLayout()); JPanel endPane = new UINoOpaquePanel(new GridLayout());
extCenterPane.add(endPane, BorderLayout.SOUTH); extCenterPane.add(endPane, BorderLayout.SOUTH);
for (int i = 0; i < COL_COUNT; i++) { for (int c = 0; c < COL_COUNT; c++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (c > 0) {
flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
}
if (c < COL_COUNT - 1) {
flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
cell.setBorderSourceFlag(flag);
cell.setPreferredSize(new Dimension(103, 30)); cell.setPreferredSize(new Dimension(103, 30));
endPane.add(cell); endPane.add(cell);
highLightCellList.add(cell); highLightCellList.add(cell);
@ -62,6 +95,7 @@ public class ECPreviewPane extends AbstractECPreviewPane {
JPanel extSouthPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel extSouthPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text")); PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text"));
assistCell.setBorderSourceFlag(CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER);
assistCell.setPreferredSize(new Dimension(123, 30)); assistCell.setPreferredSize(new Dimension(123, 30));
assistCellList.add(assistCell); assistCellList.add(assistCell);
extSouthPane.add(assistCell); extSouthPane.add(assistCell);
@ -71,11 +105,10 @@ public class ECPreviewPane extends AbstractECPreviewPane {
@Override @Override
public void refresh(TemplateTheme theme) { public void refresh(TemplateTheme theme) {
ThemedCellStyleList cellStyleConfig = theme.getCellStyleList(); ThemedCellStyleList cellStyleConfig = theme.getCellStyleList();
refresh(headerCellList, getReportHeaderStyle(cellStyleConfig)); refresh(headerCellList, cellStyleConfig.getUse4Header());
refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(contentCellList, cellStyleConfig.getUse4MainText());
refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); refresh(highLightCellList, cellStyleConfig.getUse4HighlightText());
refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); refresh(assistCellList, cellStyleConfig.getUse4SupportInfo());
refresh(assistCellList, getAssistMsgStyle(cellStyleConfig));
} }

88
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.theme.preview.ecpreview; package com.fr.design.mainframe.theme.preview.ecpreview;
import com.fr.base.CellBorderSourceFlag;
import com.fr.base.theme.ReportTheme; import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
@ -22,12 +23,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreviewed<ReportTheme> { public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreviewed<ReportTheme> {
private final List<AbstractPreviewCell> headerTitleCellList = new ArrayList<>(); private final List<AbstractPreviewCell> headerTitleCellList = new ArrayList<>(); // 大标题样式单元格
private final List<AbstractPreviewCell> headerCellList = new ArrayList<>(); private final List<AbstractPreviewCell> headerCellList = new ArrayList<>(); // 表头样式单元格
private final List<AbstractPreviewCell> titleCellList = new ArrayList<>(); private final List<AbstractPreviewCell> titleCellList = new ArrayList<>(); // 小标题样式单元格
private final List<AbstractPreviewCell> contentCellList = new ArrayList<>(); private final List<AbstractPreviewCell> contentCellList = new ArrayList<>(); // 正文样式单元格
private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>(); private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>(); // 高亮文本样式单元格
private final List<AbstractPreviewCell> assistCellList = new ArrayList<>(); private final List<AbstractPreviewCell> assistCellList = new ArrayList<>(); // 辅助信息样式单元格
private static final int CONTENT_ROW_COUNT = 3; private static final int CONTENT_ROW_COUNT = 3;
private static final int COL_COUNT = 5; private static final int COL_COUNT = 5;
@ -64,31 +65,38 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
private JPanel createNorthPane() { private JPanel createNorthPane() {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
AbstractPreviewCell bigTitleCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Cell_Style_Big_Title")); AbstractPreviewCell bigTitleCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Cell_Style_Big_Title"));
bigTitleCell.setBorderSourceFlag(CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER);
bigTitleCell.setPreferredSize(new Dimension(615, 46)); bigTitleCell.setPreferredSize(new Dimension(615, 46));
headerTitleCellList.add(bigTitleCell); headerTitleCellList.add(bigTitleCell);
northPane.add(bigTitleCell, BorderLayout.NORTH); northPane.add(bigTitleCell, BorderLayout.NORTH);
CornerPreviewCell cornerCell = new CornerPreviewCell(new String[]{Toolkit.i18nText("Fine-Design_Basic_Column_Name"), CornerPreviewCell cornerCell = new CornerPreviewCell(new String[]{Toolkit.i18nText("Fine-Design_Basic_Column_Name"),
Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Row_Name")}, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Row_Name")},
new Point2D[]{new Point(159, 71), new Point(225, 49)}); new Point2D[]{new Point(159, 71), new Point(225, 49)});
cornerCell.setBorderSourceFlag(CellBorderSourceFlag.INVALID_BORDER_SOURCE);
cornerCell.setPreferredSize(new Dimension(225, 71)); cornerCell.setPreferredSize(new Dimension(225, 71));
titleCellList.add(cornerCell); titleCellList.add(cornerCell);
northPane.add(cornerCell, BorderLayout.WEST); northPane.add(cornerCell, BorderLayout.WEST);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
northPane.add(centerPane, BorderLayout.CENTER); northPane.add(centerPane, BorderLayout.CENTER);
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title"));
cell.setBorderSourceFlag(CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER);
titleCellList.add(cell); titleCellList.add(cell);
cell.setPreferredSize(new Dimension(308, 38)); cell.setPreferredSize(new Dimension(308, 38));
centerPane.add(cell, BorderLayout.NORTH); centerPane.add(cell, BorderLayout.NORTH);
JPanel eastSouthPane = new UINoOpaquePanel(new GridLayout()); JPanel eastSouthPane = new UINoOpaquePanel(new GridLayout());
PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); for (int c = 0; c < CONTENT_ROW_COUNT; c++) {
PreviewCell cell2 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); PreviewCell headerCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
PreviewCell cell3 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
headerCellList.add(cell1); if (c > 0) {
headerCellList.add(cell2); flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
headerCellList.add(cell3); }
eastSouthPane.add(cell1); if (c < CONTENT_ROW_COUNT - 1) {
eastSouthPane.add(cell2); flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
eastSouthPane.add(cell3); }
headerCell.setBorderSourceFlag(flag);
headerCellList.add(headerCell);
eastSouthPane.add(headerCell);
}
centerPane.add(eastSouthPane, BorderLayout.CENTER); centerPane.add(eastSouthPane, BorderLayout.CENTER);
return northPane; return northPane;
} }
@ -102,8 +110,16 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
cell1.setPreferredSize(new Dimension(112, 153)); cell1.setPreferredSize(new Dimension(112, 153));
westPane.add(cell1, BorderLayout.WEST); westPane.add(cell1, BorderLayout.WEST);
JPanel gridPane = new UINoOpaquePanel(new GridLayout(5, 1)); JPanel gridPane = new UINoOpaquePanel(new GridLayout(5, 1));
for (int i = 0; i < COL_COUNT; i++) { for (int r = 0; r < COL_COUNT; r++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (r > 0) {
flag |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
}
if (r < COL_COUNT - 1) {
flag |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
}
cell.setBorderSourceFlag(flag);
cell.setPreferredSize(new Dimension(113, 31)); cell.setPreferredSize(new Dimension(113, 31));
headerCellList.add(cell); headerCellList.add(cell);
gridPane.add(cell); gridPane.add(cell);
@ -114,11 +130,36 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
centerPane.add(innerCenterPane, BorderLayout.CENTER); centerPane.add(innerCenterPane, BorderLayout.CENTER);
for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) { for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) {
PreviewCell cell ; PreviewCell cell ;
if ((i + 1) % CONTENT_ROW_COUNT == 0) { int r = i / CONTENT_ROW_COUNT;
int c = i % CONTENT_ROW_COUNT;
if (c == CONTENT_ROW_COUNT - 1) {
cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (r != 0) {
flag |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
}
if (r != COL_COUNT - 1) {
flag |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
}
cell.setBorderSourceFlag(flag);
highLightCellList.add(cell); highLightCellList.add(cell);
} else { } else {
cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (r > 0) {
flag |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
}
if (r < COL_COUNT - 1) {
flag |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
}
if (c > 0) {
flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
}
if (c < CONTENT_ROW_COUNT - 2) {
flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
cell.setBorderSourceFlag(flag);
contentCellList.add(cell); contentCellList.add(cell);
} }
cell.setPreferredSize(new Dimension(123, 31)); cell.setPreferredSize(new Dimension(123, 31));
@ -132,6 +173,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
private JPanel createSouthPane(){ private JPanel createSouthPane(){
JPanel southPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel southPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text")); PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text"));
assistCell.setBorderSourceFlag(CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER);
assistCell.setPreferredSize(new Dimension(123, 30)); assistCell.setPreferredSize(new Dimension(123, 30));
assistCellList.add(assistCell); assistCellList.add(assistCell);
southPane.add(assistCell, BorderLayout.CENTER); southPane.add(assistCell, BorderLayout.CENTER);
@ -141,12 +183,12 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
@Override @Override
public void refresh(TemplateTheme theme) { public void refresh(TemplateTheme theme) {
ThemedCellStyleList cellStyleConfig = theme.getCellStyleList(); ThemedCellStyleList cellStyleConfig = theme.getCellStyleList();
refresh(headerTitleCellList, getReportBigTitleStyle(cellStyleConfig)); refresh(headerTitleCellList, cellStyleConfig.getUse4BigTitle());
refresh(headerCellList, getReportHeaderStyle(cellStyleConfig)); refresh(headerCellList, cellStyleConfig.getUse4Header());
refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(contentCellList, cellStyleConfig.getUse4MainText());
refresh(titleCellList, getSmallTitleStyle(cellStyleConfig)); refresh(titleCellList, cellStyleConfig.getUse4SmallTitle());
refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); refresh(highLightCellList, cellStyleConfig.getUse4HighlightText());
refresh(assistCellList, getAssistMsgStyle(cellStyleConfig)); refresh(assistCellList, cellStyleConfig.getUse4SupportInfo());
} }
} }
} }

10
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe.theme.preview.ecpreview.cell; package com.fr.design.mainframe.theme.preview.ecpreview.cell;
import com.fr.base.CellBorderSourceFlag;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -12,10 +14,14 @@ public abstract class AbstractPreviewCell extends JComponent {
private static final double BORDER_INSET = 0.5D; private static final double BORDER_INSET = 0.5D;
protected Style style = Style.DEFAULT_STYLE; protected Style style = Style.DEFAULT_STYLE;
private static final int NO_SCALE_RESOLUTION = 100; private static final int NO_SCALE_RESOLUTION = 100;
private int borderSourceFlag = CellBorderSourceFlag.INVALID_BORDER_SOURCE;
public void setBorderSourceFlag(int borderSourceFlag) {
this.borderSourceFlag = borderSourceFlag;
}
public void refresh(Style style) { public void refresh(Style style, CellBorderStyle borderStyle) {
this.style = style; this.style = CellBorderSourceFlag.deriveBorderedStyle(style, borderStyle, borderSourceFlag);
} }
public void paint(Graphics g) { public void paint(Graphics g) {

7
designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

@ -9,12 +9,12 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.TemplateUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.IOUtils;
import com.fr.report.UnLockedException; import com.fr.report.UnLockedException;
import com.fr.workspace.exception.DiskSpaceFullException; import com.fr.workspace.exception.DiskSpaceFullException;
import com.fr.report.InconsistentLockException; import com.fr.report.InconsistentLockException;
import java.awt.Frame; import java.awt.Frame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.UIManager;
/** /**
* @author hades * @author hades
@ -50,7 +50,8 @@ public class SaveFailureHandler implements ThrowableHandler {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"), Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"),
Toolkit.i18nText("Fine-Design_Basic_Alert"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE,
IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"));
return true; return true;
} }
return false; return false;
@ -98,7 +99,7 @@ public class SaveFailureHandler implements ThrowableHandler {
Toolkit.i18nText("Fine-Design_Basic_Alert"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE, JOptionPane.WARNING_MESSAGE,
UIManager.getIcon("OptionPane.warningIcon"), IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"),
new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) { if (option == JOptionPane.YES_OPTION) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();

4
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -273,9 +273,9 @@ public class CreateComponentAction extends UpdateAction {
XChartEditor chartEditor = (XChartEditor) body; XChartEditor chartEditor = (XChartEditor) body;
Dimension size = chartEditor.getSize(); Dimension size = chartEditor.getSize();
BufferedImage chartImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB); BufferedImage chartImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
Insets margin = chartEditor.getInsets();; Insets margin = chartEditor.getInsets();
chartEditor.getDesignerEditor().paintEditor(chartImage.getGraphics(), size, margin); chartEditor.getDesignerEditor().paintEditor(chartImage.getGraphics(), size, margin);
im.getGraphics().drawImage(chartImage, 0, chartEditor.getY(), null); im.getGraphics().drawImage(chartImage, chartEditor.getX(), chartEditor.getY(), null);
} }
} }
return im; return im;

40
designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java

@ -5,9 +5,15 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WorkSheetDesigner; import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.ReportEnginePane; import com.fr.design.report.ReportEnginePane;
import com.fr.intelli.record.FocusPoint;
import com.fr.intelli.record.MetricRegistry;
import com.fr.intelli.record.Original;
import com.fr.json.JSONObject;
import com.fr.report.stable.LayerReportAttr;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesigner> { public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesigner> {
@ -19,7 +25,6 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon("/com/fr/design/images/m_report/reportEngineAttr"); this.setSmallIcon("/com/fr/design/images/m_report/reportEngineAttr");
this.generateAndSetSearchText(ReportEnginePane.class.getName()); this.generateAndSetSearchText(ReportEnginePane.class.getName());
} }
private boolean isChange; private boolean isChange;
@ -43,9 +48,15 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
@Override @Override
public void doOk() { public void doOk() {
isChange = true; isChange = true;
tplEC.setLayerReportAttr(layerReportEnginePane.updateBean()); LayerReportAttr originLayerReportAttr = tplEC.getLayerReportAttr();
LayerReportAttr layerReportAttr = layerReportEnginePane.updateBean();
tplEC.setLayerReportAttr(layerReportAttr);
//设置新引擎后,需要刷新一下,计算属性设置入口是否显示,取决于是否设置了新引擎模式。 //设置新引擎后,需要刷新一下,计算属性设置入口是否显示,取决于是否设置了新引擎模式。
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
//只有当前设置为新引擎时,才会提交埋点。
if (layerReportAttr.isEnableEngineX() && layerReportAttr.isChanged(originLayerReportAttr)){
new ReportEngineMetricRecord().submit(layerReportAttr);
}
} }
}); });
@ -53,4 +64,29 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
return isChange; return isChange;
} }
/**
* 内部类
* */
class ReportEngineMetricRecord{
private final static String FOCUS_ID = "FR-F6011";
private void submit(LayerReportAttr layerReportAttr){
JSONObject body = new JSONObject();
body.put("totalPage", layerReportAttr.isPageQuery() ? 1 : 0);
body.put("pagesize", layerReportAttr.getCountPerPage());
body.put("totalNum", layerReportAttr.isEnableRowCount() ? 1 : 0);
FocusPoint focusPoint = FocusPoint.newBuilder()
.id(FOCUS_ID)
.source(Original.EMBED)
.text(getPath())
.body(body.toString())
.build();
MetricRegistry.getMetric().submit(focusPoint);
}
private String getPath(){
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return currentEditingTemplate.getPath();
}
}
} }

11
designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -3,6 +3,7 @@ package com.fr.design.dscolumn;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.data.util.SortOrder; import com.fr.data.util.SortOrder;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -33,6 +34,7 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Arrays;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY;
@ -513,10 +515,11 @@ public class DSColumnAdvancedPane extends BasicPane {
public static class FormatAttrPane extends TextFormatPane { public static class FormatAttrPane extends TextFormatPane {
protected void initLayout() { protected void initLayout() {
JPanel settingPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 4, 0); JComponent[][] components = new JComponent[][] { {typeComboBox, textField, roundingBox} };
settingPane.add(typeComboBox); double[] rowSize = new double[] { TableLayout.FILL };
settingPane.add(textField); double[] columnSize = {TableLayout.PREFERRED, 200, TableLayout.PREFERRED};
settingPane.add(roundingBox);
JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 0);
addComponents(4, new JComponent[]{settingPane, previewLabel}); addComponents(4, new JComponent[]{settingPane, previewLabel});
} }

Loading…
Cancel
Save