diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 382709c92f..15fc6f1d32 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -182,7 +182,7 @@ public class EnvChangeEntrance { return true; } - private void handleWorkspaceCheckException(WorkspaceCheckException e, PopTipStrategy strategy, WorkspaceConnectionInfo info) { + public void handleWorkspaceCheckException(WorkspaceCheckException e, PopTipStrategy strategy, WorkspaceConnectionInfo info) { TestConnectionResult result = TestConnectionResult.parseByException(e); FineLoggerFactory.getLogger().error(e.getMessage(), e); if (ComparatorUtils.equals(result, TestConnectionResult.AUTH_FAILED)) { @@ -193,7 +193,9 @@ public class EnvChangeEntrance { UIManager.getIcon("OptionPane.errorIcon"))); } else { strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - new MessageWithLink(result.getText(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord"), info.getUrl() + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH), + result.isVerifyResult() + ? new MessageWithLink(result.getText(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord"), info.getUrl() + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH) + : result.getText(), Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"))); @@ -491,7 +493,7 @@ public class EnvChangeEntrance { /** * 提示显示策略 */ - enum PopTipStrategy { + public enum PopTipStrategy { /** * 切换失败,就马上提示失败,不关闭选择列表对话框 diff --git a/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java index b863717f60..c39d5b7446 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ObjectLiteConditionPane.java @@ -77,7 +77,7 @@ public class ObjectLiteConditionPane extends LiteConditionPane } }); - conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane(); + conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPaneWithGlobalListener(); Component[][] components = { { new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ConditionB_Operator") + ":"), new UILabel() }, { conditionOPComboBox, conditionValuePane } }; diff --git a/designer-base/src/main/java/com/fr/design/editor/ValueEditorPaneFactory.java b/designer-base/src/main/java/com/fr/design/editor/ValueEditorPaneFactory.java index 71959b72da..4622920996 100644 --- a/designer-base/src/main/java/com/fr/design/editor/ValueEditorPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/editor/ValueEditorPaneFactory.java @@ -19,17 +19,18 @@ import com.fr.design.editor.editor.TextEditor; import com.fr.design.editor.editor.WidgetNameEditor; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itableeditorpane.ParameterTableModel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import javax.swing.JPanel; public class ValueEditorPaneFactory { @@ -155,6 +156,16 @@ public class ValueEditorPaneFactory { return createValueEditorPane(allEditors(), StringUtils.EMPTY, StringUtils.EMPTY); } + /** + * 带有所有编辑器的ValueEditorPane + * 同时需要注册全局监听的编辑器注册下监听 + * + * @return 值编辑器面板 + */ + public static ValueEditorPane createAllValueEditorPaneWithGlobalListener() { + return createValueEditorPane(allEditorsWithGlobalListener(), StringUtils.EMPTY, StringUtils.EMPTY); + } + /** * 创建不带公式面板的pane * @@ -359,6 +370,29 @@ public class ValueEditorPaneFactory { }; } + /** + * 所有类型的编辑器 + * 同时注册需要的监听 + * + * @return 值编辑器 + */ + public static Editor[] allEditorsWithGlobalListener() { + FormulaEditor formulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); + ColumnSelectedEditor columnSelectedEditor = new ColumnSelectedEditor(); + columnSelectedEditor.registerDSChangeListener(); + return new Editor[]{ + new TextEditor(), + new IntegerEditor(), + new DoubleEditor(), + new DateEditor(true, Toolkit.i18nText("Fine-Design_Basic_Date")), + new BooleanEditor(), + formulaEditor, + new ParameterEditor(), + new ColumnRowEditor(Toolkit.i18nText("Fine-Design_Basic_Cell")), + columnSelectedEditor, + }; + } + /** * 不带公式编辑器 * diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java index ade55ae8bf..5260ce1752 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -3,6 +3,7 @@ package com.fr.design.editor.editor; import com.fr.design.data.DesignTableDataManager; import com.fr.data.SimpleDSColumn; import com.fr.design.data.datapane.TableDataComboBox; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.FRGUIPaneFactory; @@ -22,7 +23,7 @@ import java.util.regex.Pattern; * @author zhou * @since 2012-3-29下午6:05:08 */ -public class ColumnSelectedEditor extends Editor { +public class ColumnSelectedEditor extends Editor implements Prepare4DataSourceChange { TableDataComboBox tableDataComboBox; private UIComboBox columnNameComboBox; protected String[] columnNames; @@ -107,4 +108,9 @@ public class ColumnSelectedEditor extends Editor { tableDataComboBox.setSelectedItem(null); columnNameComboBox.setSelectedItem(null); } + + @Override + public void registerDSChangeListener() { + tableDataComboBox.registerGlobalDSChangeListener(); + } } diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index ba1cce5563..763ffcd1ff 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplateFactory; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.ui.util.UIUtil; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.StashedFILE; @@ -22,6 +23,7 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; +import javax.swing.SwingUtilities; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; @@ -427,4 +429,16 @@ public class HistoryTemplateListCache implements CallbackEvent { jt.refreshResource(); } } + + /** + * 重绘当前模板 + */ + public void repaintCurrentEditingTemplate(){ + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + getCurrentEditingTemplate().repaint(); + } + }); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 9810842dc2..406ab878e9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -51,6 +51,7 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; import com.fr.design.preview.PagePreview; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; @@ -120,6 +121,7 @@ public abstract class JTemplate> private PreviewProvider previewType; protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer(); public int resolution = ScreenResolution.getScreenResolution(); + private UIButton predefinedBtn; private PluginEventListener pluginListener; @@ -570,6 +572,18 @@ public abstract class JTemplate> protected abstract void applyUndoState(U u); + protected void refreshPredefinedState() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + if(predefinedBtn != null){ + JTemplate.this.predefinedBtn.setText(getTemplatePredefinedStyle()); + setPredefinedButtonSize(predefinedBtn); + } + } + }); + } + /** * 停止编辑, 判断保存属性 * */ @@ -1323,7 +1337,7 @@ public abstract class JTemplate> for (DesignerFrameUpButtonProvider provider : providers) { uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState())); } - UIButton predefinedBtn = createPreDefinedButton(); + predefinedBtn = createPreDefinedButton(); if (predefinedBtn != null) { uiButtons = ArrayUtils.addAll(uiButtons, new UIButton[]{predefinedBtn}); } @@ -1341,7 +1355,7 @@ public abstract class JTemplate> @Override public void actionPerformed(ActionEvent e) { DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - ReportPredefinedStylePane stylePane = new ReportPredefinedStylePane(JTemplate.this, preferenceButton); + ReportPredefinedStylePane stylePane = new ReportPredefinedStylePane(JTemplate.this); ReportPredefinedStyleDialog dialog = new ReportPredefinedStyleDialog(designerFrame, stylePane); PredefinedStyleInfoCollector.getInstance().collectClickNumber(); dialog.setVisible(true); @@ -1360,12 +1374,17 @@ public abstract class JTemplate> predefinedBtn.setPreferredSize(new Dimension(Math.min(metrics.stringWidth(text) + PREDEFINED_ICON_WIDTH, 100), 20)); } - public void resetPredefinedStyle(String styleName, UIButton predefinedBtn) { + public void resetPredefinedStyle(String styleName) { this.getTarget().setPredefinedStyleName(styleName, true); - predefinedBtn.setText(getTemplatePredefinedStyle()); - setPredefinedButtonSize(predefinedBtn); - this.fireTargetModified(); - this.repaint(); + refreshPredefinedState(); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + JTemplate.this.fireTargetModified(); + JTemplate.this.repaint(); + } + }); + } public String getTemplatePredefinedStyle(){ diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java index 89c35b9a9f..67b369a6c9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java @@ -96,6 +96,7 @@ public class PredefinedStyleBlock extends JPanel { private void initPane(boolean supportEdit) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); PredefinedStylePreviewPane content = new PredefinedStylePreviewPane(0.387, 0.384); + content.setParent(this); content.setPreferredSize(new Dimension(200, 180)); UILabel label = new UILabel(previewObject.getStyleName()); label.setToolTipText(previewObject.getStyleName()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java index 2a7b5592c3..6556fb9047 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java @@ -12,6 +12,7 @@ import com.fr.config.predefined.PredefinedStyle; import com.fr.config.predefined.PredefinedStyleConfig; import com.fr.config.ServerPreferenceConfig; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UITabbedPane; @@ -25,10 +26,13 @@ import com.fr.design.mainframe.predefined.ui.detail.PredefinedBackgroundSettingP import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane; import com.fr.design.mainframe.predefined.ui.detail.CellStyleListControlPane; import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -185,6 +189,12 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); this.cellStyleSettingPane = new CellStyleListControlPane(); + this.cellStyleSettingPane.registerAttrChangeListener(new AttributeChangeListener() { + @Override + public void attributeChange() { + valueChangeAction(); + } + }); jPanel.add(this.cellStyleSettingPane); return jPanel; } @@ -288,7 +298,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { if (!saveStyle(previewObject)) { return false; } - DesignUtils.refreshDesignerFrame(); + HistoryTemplateListCache.getInstance().repaintCurrentEditingTemplate(); return true; } @@ -302,7 +312,12 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { } config.add(previewObject); PredefinedStyleConfig sortedConfig = resortConfigStyles(previewObject, config); - ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(sortedConfig); + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { + @Override + public void run() { + ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(sortedConfig); + } + }); selectPane.refreshPane(); return true; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSettingPane.java index 758f8e0131..bd849414fe 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSettingPane.java @@ -9,7 +9,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; - import javax.swing.ButtonGroup; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -68,6 +67,7 @@ public abstract class PredefinedStyleSettingPane extends AbstractAttrNoScroll predefinedRadioBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + populateCustomPane(); tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined")); } }); @@ -125,6 +125,13 @@ public abstract class PredefinedStyleSettingPane extends AbstractAttrNoScroll return template.getTemplatePredefinedStyle(); } + + /** + * 用于在切换到预定义样式后重置自定义样式的设置 + */ + protected abstract void populateCustomPane(); + + /** * 展示数据 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java index 4f2c8b6035..45d2ca9fe9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java @@ -16,11 +16,9 @@ import java.awt.FlowLayout; public class ReportPredefinedStylePane extends BasicPane { private PredefinedStyleSelectPane selectPane; private JTemplate currentTemplate; - private UIButton preferenceBtn; - public ReportPredefinedStylePane(JTemplate jTemplate, UIButton preferenceButton) { + public ReportPredefinedStylePane(JTemplate jTemplate) { this.currentTemplate = jTemplate; - this.preferenceBtn = preferenceButton; initPane(); } @@ -38,7 +36,7 @@ public class ReportPredefinedStylePane extends BasicPane { public void update() { PredefinedStyle style = selectPane.update(); if (style != null) { - currentTemplate.resetPredefinedStyle(style.getStyleName(), preferenceBtn); + currentTemplate.resetPredefinedStyle(style.getStyleName()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java index 76b2a3b60d..739c927b8e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java @@ -21,6 +21,8 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.DesignUtils; import com.fr.stable.StringUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; import javax.swing.BorderFactory; import javax.swing.JOptionPane; @@ -138,8 +140,12 @@ public class ServerPredefinedStylePane extends BasicPane { if (style != null) { PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); config.setDefaultPredefinedStyle(style.getStyleName()); - ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config); - DesignUtils.refreshDesignerFrame(); + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { + @Override + public void run() { + ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config); + } + }); } } @@ -201,8 +207,12 @@ public class ServerPredefinedStylePane extends BasicPane { private void removeStyle(String name) { PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); config.removeStyle(name); - ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config); - DesignUtils.refreshDesignerFrame(); + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { + @Override + public void run() { + ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config); + } + }); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleListControlPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleListControlPane.java index b5b28ae6a9..3c966c3c49 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleListControlPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.UnrepeatedNameHelper; +import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.gui.style.AlignmentPane; @@ -24,6 +25,7 @@ import com.fr.design.mainframe.predefined.ui.detail.cell.CustomPredefinedStylePa import com.fr.design.menu.ShortCut; import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; +import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -49,6 +51,9 @@ import java.util.List; */ public class CellStyleListControlPane extends JListControlPane { private boolean namePermitted = true; + private AttributeChangeListener attributeChangeListener; + + public CellStyleListControlPane() { super(); @@ -73,6 +78,13 @@ public class CellStyleListControlPane extends JListControlPane { }); } + + + public void registerAttrChangeListener(AttributeChangeListener listener){ + this.attributeChangeListener = listener; + } + + private void showTipDialogAndReset(String content, int index) { nameableList.stopEditing(); @@ -98,6 +110,15 @@ public class CellStyleListControlPane extends JListControlPane { PredefinedCellStyle.class, CustomPredefinedStylePane.class)}; } + @Override + public BasicBeanPane createPaneByCreators(NameableCreator creator) { + CustomPredefinedStylePane stylePane = (CustomPredefinedStylePane) super.createPaneByCreators(creator); + stylePane.registerAttrChangeListener(attributeChangeListener); + return stylePane; + } + + + @Override protected String title4PopupWindow() { return StringUtils.EMPTY; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java index 0a605d4e56..5873755f57 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java @@ -98,7 +98,7 @@ public class ImageDetailPane extends AbstractBackgroundDetailPane private PredefinedCellStyle cellStyle; private PreviewArea previewArea; private boolean populating; + private AttributeChangeListener attributeChangeListener; public CustomPredefinedStylePane() { @@ -49,6 +50,16 @@ public class CustomPredefinedStylePane extends MultiTabPane tabPane.setLayout(new GridLayout(1, 3, 0, 0)); } + public void registerAttrChangeListener(AttributeChangeListener listener){ + this.attributeChangeListener = listener; + } + + private void fireAttrChangeListener() { + if (this.attributeChangeListener != null) { + this.attributeChangeListener.attributeChange(); + } + } + /** * @return */ @@ -141,6 +152,7 @@ public class CustomPredefinedStylePane extends MultiTabPane if (cellStyle != null) { previewArea.preview(cellStyle.getStyle()); } + fireAttrChangeListener(); } }); BasicScrollPane basicScrollPane = new AttrScrollPane() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java index 0fffe2ff4f..1c829c0ee6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java @@ -8,6 +8,7 @@ import com.fr.general.Background; import com.fr.general.FRFont; import com.fr.general.act.BorderPacker; import com.fr.general.act.TitlePacker; +import com.fr.stable.Constants; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -24,7 +25,7 @@ import java.awt.geom.Rectangle2D; */ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane { private PredefinedStyle style = new PredefinedStyle(); - private static final int SMALL_GAP = 5; + private static final int SMALL_GAP = 10; private static final int GAP = 10; private JPanel contentPane; private TitlePreviewPane titlePane; @@ -53,23 +54,16 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane { this.style = style; } - - @Override - public void paint(Graphics g) { - paintContent(g); - - - } - - public void paintContent(Graphics g) { + public void paintComponents(Graphics g) { BorderPacker borderStyle = style.getComponentStyle().getBorderStyle(); updateBorders(g, borderStyle); paintTitle(g, borderStyle.getTitle()); - paintContentPane(g,borderStyle); + paintContentPane(g, borderStyle); + super.paintComponents(g); } private void paintContentPane(Graphics g, BorderPacker borderStyle) { @@ -79,18 +73,15 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane { if (borderStyle.getBackground() != null) { borderStyle.getBackground().paint(clipg, clipg.getClipBounds()); } - this.contentPane.paint(clipg); clipg.dispose(); - } private void paintTitle(Graphics g, TitlePacker titlePacker) { - FRFont font = titlePacker.getFrFont(); Background background = titlePacker.getBackground(); if (background != null) { background.paint(g, new Rectangle2D.Double(10, 5, this.titlePane.getWidth(), this.titlePane.getHeight())); } - titlePane.setFontObject(font); + titlePane.setTitleObject(titlePacker); titlePane.paintComponent(g); } @@ -103,6 +94,7 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane { private class TitlePreviewPane extends JPanel { private FRFont frFont = null; + private int titlePosition = Constants.LEFT; public TitlePreviewPane() { this.setBackground(null); @@ -127,19 +119,23 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane { } else { g2d.setColor(new Color(237, 237, 237)); } - g2d.setFont(frFont.applySize(14).applyResolutionNP(96)); - int startY = 0; - startY = (d.height + fm.getHeight()) / 2; - drawTabBack(g2d, startY); - } - - private void drawTabBack(Graphics2D g2d, int startY) { + g2d.setFont(frFont.applyResolutionNP(96)); String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Preview_Title_Text"); - GraphHelper.drawString(g2d, paintText, GAP, 32); + int startY = 0, startX = 0; + startX = (d.width - fm.stringWidth(paintText)) / 2; + startY = (d.height - fm.getHeight()) / 2 + fm.getAscent(); + if (this.titlePosition == Constants.LEFT) { + startX = GAP; + } else if (this.titlePosition == Constants.RIGHT) { + startX = d.width - fm.stringWidth(paintText) - GAP - fm.getMaxAdvance(); + } + GraphHelper.drawString(g2d, paintText, startX, startY); + } - public void setFontObject(FRFont font) { - this.frFont = font; + public void setTitleObject(TitlePacker titlePacker) { + this.frFont = titlePacker.getFrFont(); + this.titlePosition = titlePacker.getPosition(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java index 1e25c01d02..a7ec75e89c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java @@ -1,21 +1,26 @@ package com.fr.design.mainframe.predefined.ui.preview; -import com.fr.design.gui.ilable.UILabel; +import com.fr.base.ScreenResolution; +import com.fr.base.Style; +import com.fr.config.predefined.PredefinedCellStyle; +import com.fr.config.predefined.PredefinedCellStyleConfig; +import com.fr.config.predefined.PredefinedStyle; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; - +import com.fr.third.javax.annotation.Nonnull; +import javax.swing.JComponent; import javax.swing.JPanel; -import javax.swing.JSeparator; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; /** * Created by kerry on 2020-09-04 @@ -23,6 +28,7 @@ import java.awt.Dimension; public class ElementCasePreview extends ComponentPreviewPane { private static final List PREVIEW_DATA_LIST = new ArrayList<>(); private static final String BLANK_CHAR = " "; + private List gridRowPanes; static { readPreviewData(); @@ -44,56 +50,122 @@ public class ElementCasePreview extends ComponentPreviewPane { } } + @Override protected JPanel createContentPane() { - + gridRowPanes = new ArrayList<>(); JPanel jPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); jPanel.setOpaque(false); jPanel.setBackground(null); - FRFont font = FRFont.getInstance(); - font = font.applySize(11); - FRFont titleFont = font.applySize(14).applyForeground(Color.decode("#63B2EE")); - FRFont endFont = font.applySize(11).applyForeground(Color.decode("#1B97FF")); for (int i = 0; i < PREVIEW_DATA_LIST.size(); i++) { - FRFont frFont = font; + GridRowPane gridRowPane = new GridRowPane(PREVIEW_DATA_LIST.get(i), Style.DEFAULT_STYLE); + gridRowPanes.add(gridRowPane); + jPanel.add(gridRowPane); + } + return jPanel; + } + + + public void refresh(PredefinedStyle style) { + super.refresh(style); + PredefinedCellStyleConfig cellStyleConfig = style.getCellStyleConfig(); + for (int i = 0; i < gridRowPanes.size(); i++) { + Style renderStyle = getMainContentStyle(cellStyleConfig); if (i == 0) { - frFont = titleFont; + renderStyle = getReportHeaderStyle(cellStyleConfig); } if (i == PREVIEW_DATA_LIST.size() - 1) { - frFont = endFont; + renderStyle = getHighLightStyle(cellStyleConfig); } - jPanel.add(new GridRowPane(frFont, PREVIEW_DATA_LIST.get(i))); - + gridRowPanes.get(i).preview(renderStyle); } + } - return jPanel; + + private Style getReportHeaderStyle(PredefinedCellStyleConfig config) { + return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); } + private Style getMainContentStyle(PredefinedCellStyleConfig config) { + return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); + } + + private Style getHighLightStyle(PredefinedCellStyleConfig config) { + return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); + } + + @Nonnull + private Style getCellStyle(PredefinedCellStyleConfig config, String styleName) { + PredefinedCellStyle cellStyle = config.getStyle(styleName); + if (cellStyle == null) { + return Style.DEFAULT_STYLE; + } + return cellStyle.getStyle(); + } + + class GridRowPane extends JPanel { - public GridRowPane(FRFont frFont, String[] data) { + private List gridPreviews = new ArrayList<>(); + + public GridRowPane(String[] data, Style style) { this.setOpaque(false); this.setBackground(null); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel panel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(4, 20, 10); + JPanel panel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(4, 0, 0); panel.setOpaque(false); panel.setBackground(null); for (String text : data) { - panel.add(createLabel(text, frFont)); + GridPreview gridPreview = new GridPreview(text); + gridPreviews.add(gridPreview); + panel.add(gridPreview); } this.add(panel, BorderLayout.CENTER); - JSeparator jSeparator = new JSeparator(); - jSeparator.setPreferredSize(new Dimension(246, 2)); - this.add(jSeparator, BorderLayout.SOUTH); + preview(style); } - private UILabel createLabel(String text, FRFont frFont) { - UILabel label = new UILabel(text); - label.setFont(frFont); - label.setForeground(frFont.getForeground()); - label.setBackground(null); - return label; + public void preview(Style style) { + for (GridPreview grid : gridPreviews) { + grid.preview(style); + } } + } + + private static class GridPreview extends JComponent { + + private Style style = Style.DEFAULT_STYLE; + private String value; + + public GridPreview(String value) { + this.value = value; + setPreferredSize(new Dimension(125, 30)); + } + + public void preview(Style style) { + this.style = style; + } + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + int resolution = ScreenResolution.getScreenResolution(); + + if (style == Style.DEFAULT_STYLE) { + Style.paintContent(g2d, value, style, getWidth() - 3, getHeight() - 3, resolution); + return; + } + + Style.paintBackground(g2d, style, getWidth(), getHeight()); + + Style.paintContent(g2d, value, style, getWidth() - 3, getHeight() - 3, resolution); + + Style.paintBorder(g2d, style, getWidth() , getHeight() ); + } + + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java index b876d723f9..5b6d200491 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java @@ -37,7 +37,9 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen private ChartPreStylePreView columnChartPane; private int COLUMN_CHART_WIDTH = 517; - private int COLUMN_CHART_HEIGHT = 300; + private int COLUMN_CHART_HEIGHT = 290; + + private JPanel parent; public PredefinedStylePreviewPane() { this(1.0, 1.0); @@ -49,10 +51,14 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen this.setBackground(Color.WHITE); this.elementCasePreview = new ElementCasePreview(); this.add(initChartPreViewPane()); - this.elementCasePreview.setPreferredSize(new Dimension(517, 190)); + this.elementCasePreview.setPreferredSize(new Dimension(517, 200)); this.add(this.elementCasePreview); } + public void setParent(JPanel parent) { + this.parent = parent; + } + private JPanel initChartPreViewPane() { columnChartPane = new ChartPreStylePreView(initVanColumnChart()); columnChartPane.setPreferredSize(new Dimension(COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT)); @@ -114,7 +120,7 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen this.columnChartPane.paintComponent(g); g.translate(0, COLUMN_CHART_HEIGHT); - this.elementCasePreview.paintContent(g); + this.elementCasePreview.paintComponents(g); g.translate(0, -COLUMN_CHART_HEIGHT); // 恢复双缓冲 ComponentUtils.resetBuffer(dbcomponents); @@ -142,6 +148,10 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen @Override public void callback() { - this.repaint(); + if (parent != null) { + parent.repaint(); + } else { + this.repaint(); + } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 42d1d3862c..894ebe1c17 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -54,7 +54,9 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; +import com.fr.design.menu.SnapChatMenuDef; import com.fr.design.menu.ToolBarDef; +import com.fr.design.notification.SnapChatAllTypes; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -72,7 +74,6 @@ import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; @@ -468,7 +469,9 @@ public abstract class ToolBarMenuDock { } protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) { - MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic__M_Server"), 'S'); + + MenuDef menuDef = new SnapChatMenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic__M_Server"), 'S', + SnapChatAllTypes.Menu.SERVER); if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut( @@ -563,12 +566,12 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { - + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); - + shortCuts.add(SeparatorDef.DEFAULT); - + shortCuts.add(new VideoAction()); LocaleCenter.buildAction(new LocaleAction() { @Override @@ -578,7 +581,7 @@ public abstract class ToolBarMenuDock { }, SupportLocaleImpl.TUTORIAL_COMMUNITY); shortCuts.add(new QuestionAction()); shortCuts.add(new TechSolutionAction()); - + shortCuts.add(SeparatorDef.DEFAULT); LocaleCenter.buildAction(new LocaleAction() { @@ -608,9 +611,9 @@ public abstract class ToolBarMenuDock { shortCuts.add(new TechSupportAction()); } }, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY); - + shortCuts.add(SeparatorDef.DEFAULT); - + shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); LocaleCenter.buildAction(new LocaleAction() { diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java index 34e73d9834..94779d9d74 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java @@ -12,7 +12,13 @@ public abstract class SnapChatAllTypes { /** * 社区按钮 */ - BBS("BBS"); + BBS("BBS"), + + /** + * 服务器按钮 + */ + SERVER("SERVER"); + private static final String SIGN = "0001"; diff --git a/designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData b/designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData index 263e85a73d..cfcf502f3f 100644 --- a/designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData +++ b/designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData @@ -2,5 +2,4 @@ 南通市 324,646 324,646 100% 合肥市 248,938 348,938 140% 邵阳市 248,938 348,938 140% -苏州市 248,938 348,938 140% -合计 1,071,460 1,371,460 128% \ No newline at end of file +合计 1,071,460 1,371,460 128% diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/FormPredefinedBackgroundPane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/FormPredefinedBackgroundPane.java index 58787a19d0..c862ac76d7 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/FormPredefinedBackgroundPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/FormPredefinedBackgroundPane.java @@ -63,13 +63,21 @@ public class FormPredefinedBackgroundPane extends PredefinedStyleSettingPane implements BaseJForm { private int resolution = ScreenResolution.getScreenResolution(); public JWorkBook() { - super(new WorkBook(new WorkSheet()), DEFAULT_WB_FILE_PREFIX); - initPredefinedInfo(); + super(new WorkBook(createPredefinedWorkSheet()), DEFAULT_WB_FILE_PREFIX); populateReportParameterAttr(); } - private void initPredefinedInfo() { - WorkBook workBook = this.getTarget(); - for (int i = 0; i < workBook.getReportCount(); i++) { - Report report = workBook.getReport(i); - if (report != null) { - NameBackground initBackground = NameBackground.createPredefinedStyle(StringUtils.EMPTY); - ((ReportSettings) report.getReportSettings()).setNameBackground(initBackground); - } - } + private static WorkSheet createPredefinedWorkSheet() { + WorkSheet sheet = new WorkSheet(); + NameBackground initBackground = NameBackground.createPredefinedStyle(StringUtils.EMPTY); + ((ReportSettings) sheet.getReportSettings()).setNameBackground(initBackground); + return sheet; } + public JWorkBook(WorkBookX workBookX) { super(new WorkBookAdapter(workBookX), DEFAULT_WBX_FILE_PREFIX); populateReportParameterAttr(); @@ -776,6 +769,7 @@ public class JWorkBook extends JTemplate { if (hasParameterPane()) { parameterPane.populate(u.getApplyTarget()); setAutoHeightForCenterPane(); + reportComposite.setSelectedIndex(u.getSelectedReportIndex()); DesignModuleFactory.getFormHierarchyPane().refreshRoot(); } } else { @@ -793,6 +787,7 @@ public class JWorkBook extends JTemplate { } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } + refreshPredefinedState(); } private void applyAll(WorkBookUndoState u) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java index 66fed7afe2..9377c619a7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java @@ -5,7 +5,7 @@ import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.designer.EditingState; import com.fr.design.event.RemoveListener; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.grid.Grid; @@ -18,8 +18,6 @@ import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.util.ArrayList; @@ -85,7 +83,10 @@ public class ReportComponentComposite extends JComponent implements RemoveListen value = value > MAX ? MAX : value; value = value < MIN ? MIN : value; int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.setScale(resolution); + } } }; @@ -119,8 +120,12 @@ public class ReportComponentComposite extends JComponent implements RemoveListen templateStateList.add(null); } centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement()); - // Yvan: REPORT-37950 普通报表-多sheet-报表块缩放失效 - //jSliderContainer = JFormSliderPane.getInstance(); + // 这里jSliderContainer有可能为null,做个判断 + if (jSliderContainer == null) { + jSliderContainer = JFormSliderPane.getInstance(); + } + // 为新建的sheet的缩放条初始值置为100 + jSliderContainer.setShowValue(HUND); } if (centerCardPane.editingComponet.elementCasePane == null) { @@ -206,8 +211,9 @@ public class ReportComponentComposite extends JComponent implements RemoveListen hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); JPanel southPane = new JPanel(new BorderLayout()); - jSliderContainer = JFormSliderPane.getInstance(); - + if (jSliderContainer == null) { + jSliderContainer = JFormSliderPane.getInstance(); + } southPane.add(hbarContainer, BorderLayout.NORTH); southPane.add(sheetNameTab, BorderLayout.CENTER); southPane.add(jSliderContainer, BorderLayout.EAST); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index ead1cf2f1e..bfe525eb7d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -38,6 +38,7 @@ import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.form.ui.NameBackground; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; @@ -45,7 +46,9 @@ import com.fr.main.impl.WorkBook; import com.fr.poly.PolyDesigner; import com.fr.report.poly.PolyWorkSheet; import com.fr.report.report.TemplateReport; +import com.fr.report.stable.ReportSettings; import com.fr.report.worksheet.WorkSheet; +import com.fr.stable.StringUtils; /** * NameTabPane of sheets @@ -847,11 +850,18 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse protected abstract String getTemplateReportType(); } + private void initPredefinedInfo(TemplateReport report){ + NameBackground initBackground = NameBackground.createPredefinedStyle(StringUtils.EMPTY); + ((ReportSettings) report.getReportSettings()).setNameBackground(initBackground); + } + protected class GridReportInsertAction extends SheetInsertAction { @Override protected TemplateReport newTemplateReport() { - return new WorkSheet(); + WorkSheet workSheet = new WorkSheet(); + initPredefinedInfo(workSheet); + return workSheet; } @Override @@ -863,7 +873,9 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse protected class PolyReportInsertAction extends SheetInsertAction { @Override protected TemplateReport newTemplateReport() { - return new PolyWorkSheet(); + PolyWorkSheet polyWorkSheet = new PolyWorkSheet(); + initPredefinedInfo(polyWorkSheet); + return polyWorkSheet; } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index 1fd08a7618..98311cd993 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -43,19 +43,18 @@ public class CellStylePane extends AbstractCellAttrPane { @Override public String getIconPath() { -// return "com/fr/design/images/m_format/cell.png"; return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Style"); } @Override public void updateBean(TemplateCellElement cellElement) { - cellElement.setStyle(stylePane.updateBean()); + cellElement.setStyle(stylePane.updateStyle()); } @Override public void updateBeans() { - NameStyle s = stylePane.updateBean(); + Style s = stylePane.updateStyle(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); int cellRectangleCount = cs.getCellRectangleCount(); for (int rect = 0; rect < cellRectangleCount; rect++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java index a8efff6b98..6a111b781d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java @@ -16,7 +16,6 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.AbstractBasicStylePane; import com.fr.design.gui.style.AlignmentPane; -import com.fr.design.gui.style.BackgroundPane; import com.fr.design.gui.style.BorderPane; import com.fr.design.gui.style.FormatPane; import com.fr.design.layout.FRGUIPaneFactory; @@ -29,6 +28,7 @@ import com.fr.design.style.BorderUtils; import com.fr.predefined.PredefinedPatternStyleManager; import com.fr.stable.Constants; import com.fr.stable.StringUtils; +import com.fr.third.javax.annotation.Nonnull; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -85,9 +85,7 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane allStyle = config.getAllStyles(); this.applicationFormat.clearBoxItems(); @@ -103,6 +101,13 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane { @@ -132,7 +146,6 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane