From cb871b2bf23aff1e5d7583f09cb5a1b3f9370fa6 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 30 Sep 2020 11:24:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-35149=20=E9=A2=84=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96=E5=8F=8A=E4=B8=8E=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/CellWidgetPropertyPane.java | 6 +++--- .../com/fr/design/mainframe/cell/CellElementEditPane.java | 4 ++-- .../fr/design/present/ConditionAttributesGroupPane.java | 4 ++-- designer-realize/src/main/java/com/fr/grid/Grid.java | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java index 246bb72aa..a7a29cfe4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java @@ -11,7 +11,7 @@ import com.fr.grid.selection.Selection; import com.fr.log.FineLoggerFactory; import com.fr.privilege.finegrain.WidgetPrivilegeControl; import com.fr.report.cell.CellElement; -import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.DefaultPredefinedTemplateCellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.elementcase.TemplateElementCase; @@ -59,7 +59,7 @@ public class CellWidgetPropertyPane extends BasicPane { public void populate(TemplateCellElement cellElement) { if (cellElement == null) {// 利用默认的CellElement. - cellElement = new DefaultTemplateCellElement(0, 0, null); + cellElement = new DefaultPredefinedTemplateCellElement(0, 0, null); } Widget cellWidget = cellElement.getWidget(); @@ -88,7 +88,7 @@ public class CellWidgetPropertyPane extends BasicPane { final TemplateElementCase tplEC = ePane.getEditingElementCase(); TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); if (editCellElement == null) { - editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + editCellElement = new DefaultPredefinedTemplateCellElement(cs.getColumn(), cs.getRow()); } this.cellElement = editCellElement; this.populate(editCellElement); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java index 487214a80..108cad815 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java @@ -14,7 +14,7 @@ import com.fr.general.ComparatorUtils; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; import com.fr.report.cell.CellElement; -import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.DefaultPredefinedTemplateCellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.elementcase.TemplateElementCase; @@ -112,7 +112,7 @@ public class CellElementEditPane extends BasicPane { CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow()); if (cellElement == null) { - cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + cellElement = new DefaultPredefinedTemplateCellElement(cs.getColumn(), cs.getRow()); //默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错 if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) { elementCase.addCellElement((TemplateCellElement) cellElement); diff --git a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java index ad0c57b51..cb5acdf86 100644 --- a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java @@ -12,7 +12,7 @@ import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; import com.fr.log.FineLoggerFactory; import com.fr.report.cell.CellElement; -import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.DefaultPredefinedTemplateCellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.highlight.DefaultHighlight; import com.fr.report.cell.cellattr.highlight.Highlight; @@ -82,7 +82,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane { final TemplateElementCase tplEC = ePane.getEditingElementCase(); editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); if (editCellElement == null) { - editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + editCellElement = new DefaultPredefinedTemplateCellElement(cs.getColumn(), cs.getRow()); } SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里 diff --git a/designer-realize/src/main/java/com/fr/grid/Grid.java b/designer-realize/src/main/java/com/fr/grid/Grid.java index a16d64ead..95fcaf82f 100644 --- a/designer-realize/src/main/java/com/fr/grid/Grid.java +++ b/designer-realize/src/main/java/com/fr/grid/Grid.java @@ -28,7 +28,7 @@ import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.report.ReportHelper; import com.fr.report.cell.CellElement; -import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.DefaultPredefinedTemplateCellElement; import com.fr.report.cell.FloatElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellGUIAttr; @@ -865,7 +865,7 @@ public class Grid extends BaseGridComponent { } // 必须保证editingCellElement不是null。 if (editingCellElement == null) { - editingCellElement = new DefaultTemplateCellElement(column, row); + editingCellElement = new DefaultPredefinedTemplateCellElement(column, row); } editorComponent = getCellEditingComp(); if (editorComponent == null) { @@ -1029,7 +1029,7 @@ public class Grid extends BaseGridComponent { } // 必须保证editingCellElement不是null。 if (editingCellElement == null) { - editingCellElement = new DefaultTemplateCellElement(editingColumn, editingRow); + editingCellElement = new DefaultPredefinedTemplateCellElement(editingColumn, editingRow); tplEC.addCellElement(editingCellElement); } if (setValue4EditingElement(newValue)) { @@ -1455,4 +1455,4 @@ public class Grid extends BaseGridComponent { this.paginateLineShowType = paginateLineShowType; this.getElementCasePane().repaint(); } -} \ No newline at end of file +} From e3c78dc4cc0ee183481899ff7dea106b58df1aeb Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 30 Sep 2020 16:39:57 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-40001=20=E3=80=90=E9=A2=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A0=B7=E5=BC=8F=E3=80=91=E5=BA=94=E8=AF=A5=E6=98=AF?= =?UTF-8?q?=E6=88=91=E4=BB=AC=E4=BF=AE=E6=94=B9=E6=9F=90=E4=B8=AA=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E5=B0=B1=E6=98=BE=E7=A4=BA=E5=9C=A8=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=9C=80=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 3 +- .../ui/PredefinedStyleEditPane.java | 30 +++++++- .../ui/detail/CellStyleListControlPane.java | 70 +++++++++++++++++-- .../cell/CustomPredefinedStylePane.java | 17 ----- .../layout/FRFitLayoutDefinePane.java | 4 ++ 5 files changed, 101 insertions(+), 23 deletions(-) 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 6129f8746..d603b3f32 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.utils.DesignUtils; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.file.FILE; @@ -1353,7 +1354,7 @@ public abstract class JTemplate> predefinedBtn.setText(getTemplatePredefinedStyle()); setPredefinedButtonSize(predefinedBtn); this.fireTargetModified(); - this.repaint(); + DesignUtils.refreshDesignerFrame(); } public String getTemplatePredefinedStyle(){ 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 c267082b4..02d4691ee 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 @@ -28,6 +28,9 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Dimension; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; /** * Created by kerry on 2020-08-26 @@ -245,7 +248,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { return false; } config.add(previewObject); - ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config); + PredefinedStyleConfig sortedConfig = resortConfigStyles(previewObject, config); + ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(sortedConfig); selectPane.refreshPane(); return true; } @@ -275,4 +279,28 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { return true; } + private PredefinedStyleConfig resortConfigStyles(PredefinedStyle priorityStyle, PredefinedStyleConfig config){ + PredefinedStyleConfig sortedConfig = new PredefinedStyleConfig(); + PredefinedStyle defaultStyle = config.getDefaultPredefinedStyle(); + if (defaultStyle != null) { + sortedConfig.add(defaultStyle); + config.removeStyle(defaultStyle.getStyleName()); + sortedConfig.setDefaultPredefinedStyle(defaultStyle.getStyleName()); + } + if (priorityStyle != null && !priorityStyle.isDefaultStyle()) { + sortedConfig.add(priorityStyle); + config.removeStyle(priorityStyle.getStyleName()); + } + Iterator iterator = config.getPredefinedStyleIterator(); + while (iterator.hasNext()) { + PredefinedStyle entry = iterator.next(); + sortedConfig.add(entry); + } + sortedConfig.setCompatibleStyleName(config.getCompatibleStyleName()); + return sortedConfig; + } + + + + } 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 9ff67444d..b5b28ae6a 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 @@ -6,6 +6,7 @@ import com.fr.config.predefined.PredefinedCellStyle; import com.fr.config.predefined.PredefinedCellStyleConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.NameInspector; import com.fr.design.gui.controlpane.JListControlPane; @@ -15,6 +16,8 @@ import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ModNameActionListener; +import com.fr.design.gui.style.AlignmentPane; +import com.fr.design.gui.style.FormatPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.predefined.ui.detail.cell.CustomPredefinedStylePane; @@ -83,8 +86,16 @@ public class CellStyleListControlPane extends JListControlPane { @Override public NameableCreator[] createNameableCreators() { - return new NameableCreator[]{new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), - PredefinedCellStyle.class, CustomPredefinedStylePane.class)}; + return new NameableCreator[]{ + new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), + PredefinedCellStyle.class, CustomPredefinedStylePaneNoBorder.class) { + @Override + public boolean acceptDefaultNameObject(Object ob) { + return ((PredefinedCellStyle) ob).isDefaultStyle(); + } + }, + new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), + PredefinedCellStyle.class, CustomPredefinedStylePane.class)}; } @Override @@ -113,13 +124,45 @@ public class CellStyleListControlPane extends JListControlPane { protected ShortCut4JControlPane[] createShortcuts() { return new ShortCut4JControlPane[]{ - shortCutFactory.addItemShortCut(), + createAddItemShortCut4JControlPane(), new RemoveItemShortCut4JControlPane(new RemoveItemAction()) }; } - public class RemoveItemShortCut4JControlPane extends ShortCut4JControlPane { + private static class CustomPredefinedStylePaneNoBorder extends CustomPredefinedStylePane { + @Override + protected List initPaneList() { + paneList = new ArrayList(); + paneList.add(new FormatPane()); + paneList.add(new AlignmentPane()); + return paneList; + } + + } + + + private ShortCut4JControlPane createAddItemShortCut4JControlPane (){ + ShortCut shortCut = shortCutFactory.createAddItemUpdateAction(new NameableCreator[]{ + new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), + PredefinedCellStyle.class, CustomPredefinedStylePane.class)}); + return new AddItemShortCut4JControlPane(shortCut); + } + + private class AddItemShortCut4JControlPane extends ShortCut4JControlPane{ + AddItemShortCut4JControlPane(ShortCut shortCut) { + this.shortCut = shortCut; + } + + + @Override + public void checkEnable() { + this.shortCut.setEnabled(true); + } + } + + + private class RemoveItemShortCut4JControlPane extends ShortCut4JControlPane { RemoveItemShortCut4JControlPane(ShortCut shortCut) { this.shortCut = shortCut; } @@ -180,6 +223,25 @@ public class CellStyleListControlPane extends JListControlPane { } return null; } + /** + * + * @param ob + * @return + */ + public Object acceptObject2Populate(Object ob) { + if (ob instanceof NameObject) { + ob = ((NameObject) ob).getObject(); + } + if (clazzOfObject != null && clazzOfObject.isInstance(ob) && acceptDefaultNameObject(ob)) { + doSthChanged4Icon(ob); + return ob; + } + return null; + } + + public boolean acceptDefaultNameObject(Object ob) { + return !((PredefinedCellStyle) ob).isDefaultStyle(); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/cell/CustomPredefinedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/cell/CustomPredefinedStylePane.java index e3e19f587..8da5c61ce 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/cell/CustomPredefinedStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/cell/CustomPredefinedStylePane.java @@ -49,14 +49,6 @@ public class CustomPredefinedStylePane extends MultiTabPane tabPane.setLayout(new GridLayout(1, 3, 0, 0)); } - public static CustomPredefinedStylePane createPredefinedStylePane() { - return new CustomPredefinedStylePane(); - } - - public static CustomPredefinedStylePane createDefaultPredefinedStylePane() { - return new CustomPredefinedStylePaneNoBorder(); - } - /** * @return */ @@ -172,16 +164,7 @@ public class CustomPredefinedStylePane extends MultiTabPane } - private static class CustomPredefinedStylePaneNoBorder extends CustomPredefinedStylePane { - @Override - protected List initPaneList() { - paneList = new ArrayList(); - paneList.add(new FormatPane()); - paneList.add(new AlignmentPane()); - return paneList; - } - } /** * 预览Style的面板 diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index a3a703fae..4e5088f54 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -12,6 +12,7 @@ import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.properties.items.FRFitConstraintsItems; import com.fr.design.designer.properties.items.FRLayoutTypeItems; import com.fr.design.designer.properties.items.Item; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; @@ -194,11 +195,14 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Fri, 9 Oct 2020 07:27:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d603b3f32..0cfc5110e 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 @@ -1354,7 +1354,7 @@ public abstract class JTemplate> predefinedBtn.setText(getTemplatePredefinedStyle()); setPredefinedButtonSize(predefinedBtn); this.fireTargetModified(); - DesignUtils.refreshDesignerFrame(); + this.repaint(); } public String getTemplatePredefinedStyle(){ From acbea7be36a984d23fcfa6cfdb1bc26f12330c0f Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 9 Oct 2020 07:29:05 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 1 - 1 file changed, 1 deletion(-) 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 0cfc5110e..6129f8746 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,7 +51,6 @@ 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.utils.DesignUtils; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.file.FILE;