From ca9adb83ede082e06669eb59b011c22951ec21ba Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 27 Sep 2024 15:17:25 +0800 Subject: [PATCH 01/29] =?UTF-8?q?REPORT-132266=20fix:=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E6=A1=86=E6=95=B0=E6=8D=AE=20Windows=20?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=95=B0=E6=8D=AE=E9=94=99=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/light/ui/FineComboCheckBoxUI.java | 37 +++++++++++++++ .../components/ComboCheckBoxStoryBoard.java | 46 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java create mode 100644 designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java new file mode 100644 index 0000000000..dd63f1c3be --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java @@ -0,0 +1,37 @@ +package com.fine.theme.light.ui; + +import com.formdev.flatlaf.ui.FlatComboBoxUI; + +import javax.swing.JComponent; +import javax.swing.UIManager; +import javax.swing.plaf.ComponentUI; + + +/** + * {@link com.fr.design.gui.icombocheckbox.UIComboCheckBox} 的 UI 样式 + * + * @author lemon + * @since 12.0 + * Created on 2024/09/27 + */ +public class FineComboCheckBoxUI extends FlatComboBoxUI { + + public FineComboCheckBoxUI() { + super(); + } + + /** + * 创建UI + */ + public static ComponentUI createUI(JComponent c) { + return new FineComboCheckBoxUI(); + } + + @Override + public void installUI(JComponent c) { + super.installUI(c); + c.setBackground(UIManager.getColor("ComboCheckBox.background")); + c.setBorder(UIManager.getBorder("ComboCheckBox.border")); + } + +} diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java new file mode 100644 index 0000000000..21a2bc7e28 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java @@ -0,0 +1,46 @@ +package com.fr.design.gui.storybook.components; + +import com.fr.design.gui.icombocheckbox.UIComboCheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.storybook.StoryBoard; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.stable.ArrayUtils; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; + +public class ComboCheckBoxStoryBoard extends StoryBoard { + public ComboCheckBoxStoryBoard() { + super("下拉多选框"); + + + add( + cell(new UILabel("普通状态")).with(this::h3), + cell(getComboCheckBox(ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4"))), + + cell(new UILabel("长文字状态")).with(this::h3), + cell(getComboCheckBox(ArrayUtils.toArray("测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1", + "测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2", + "测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3", + "测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4"))), + + flex() + ); + } + + private UIComboCheckBox getComboCheckBox(Object[] array) { + return new UIComboCheckBox(array, true) { + protected void setLayoutAndAddComponents() { + // 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白 + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel pane = getClickPane(); + pane.setOpaque(false); + this.add(pane, BorderLayout.CENTER); + } + }; + } + +} From 2c407ddf7a4c42a139b77799c374f7693192eee8 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 27 Sep 2024 15:18:34 +0800 Subject: [PATCH 02/29] =?UTF-8?q?REPORT-132266=20fix:=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E6=A1=86=E6=95=B0=E6=8D=AE=20Windows=20?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=95=B0=E6=8D=AE=E9=94=99=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/utils/FineUIStyle.java | 2 + .../TableDataDesensitizationTableModel.java | 17 +-- .../gui/icombocheckbox/UICheckListPopup.java | 11 +- .../gui/icombocheckbox/UIComboCheckBox.java | 135 +++++++++++------- .../theme/light/ui/laf/FineLaf.properties | 1 + .../light/ui/laf/FineLightLaf.properties | 18 +++ .../model/DesensitizationCellPane.java | 7 +- 7 files changed, 118 insertions(+), 73 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 05e55df51d..e2186efc4e 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -41,6 +41,7 @@ public interface FineUIStyle { String POPUP_MENU_TOOL_BAR = "popupMenuToolBar"; String POPUP_MENU_DROPDOWN = "dropdownPopupMenu"; String TRANSPARENT_TEXT_FIELD = "transparentTextField"; + String OFFET_LEFT_TEXT_FIELD = "offsetLeftText"; String TRANSPARENT_BACKGROUND = "transparentBackground"; String PURE_LIST = "pureList"; String NO_BORDER_LIST = "noBorderList"; @@ -51,6 +52,7 @@ public interface FineUIStyle { String DEFAULT_TABLE = "defaultTable"; String WHITE_BUTTON = "whiteButton"; String ORIGINAL_BUTTON = "originalButton"; + String PLAIN_ARROW_BUTTON = "plainArrowButton"; String GRAY_BUTTON = "grayButton"; String DETAIL_LABEL = "detailLabel"; String WIDGET_EVENT_LABEL = "widgetEventLabel"; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java index 7c5aa47d43..b55479dc9a 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java @@ -1,7 +1,6 @@ package com.fr.design.data.datapane.preview.desensitization.view.setting; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.data.desensitize.base.DesensitizationTableData; @@ -14,7 +13,6 @@ import com.fr.design.data.datapane.preview.desensitization.view.rule.Desensitiza import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icombobox.ComboCheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombocheckbox.UIComboCheckBox; import com.fr.design.gui.ilable.UILabel; @@ -39,7 +37,6 @@ import javax.swing.UIManager; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -57,6 +54,8 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; +import static com.fine.theme.utils.FineUIStyle.setStyle; + /** * 处理TableDataDesensitizationTablePane中TableEditPane的Model * @@ -367,12 +366,6 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter listeners = new ArrayList(); private List checkBoxList = new ArrayList(); @@ -120,15 +124,12 @@ public class UICheckListPopup extends UIPopupMenu { } private void addOneCheckValue(Object checkValue) { - JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - checkPane.setPreferredSize(FineUIScale.scale(new Dimension(144, CHECKBOX_HEIGHT))); + JPanel checkPane = new JPanel(new BorderLayout()); final JCheckBox temp = createCheckbox(); final UILabel label = new UILabel(checkValue.toString()); label.setBackground(Color.WHITE); - label.setPreferredSize(FineUIScale.scale(new Dimension(100, 20))); checkPane.setBackground(Color.WHITE); - checkPane.add(temp); - checkPane.add(label); + checkPane.add(row(fix(4), cell(temp), cell(label)).getComponent()); if (labelNeedToolTips) { // 设置每项Label的tooltips为其省略前的内容 label.setToolTipText(checkValue.toString()); diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java index 977c02e134..400c5594ab 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java @@ -2,19 +2,20 @@ package com.fr.design.gui.icombocheckbox; import com.fine.theme.icon.LazyIcon; import com.fine.theme.light.ui.FineRoundBorder; -import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.HoverAware; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StringUtils; import javax.swing.Icon; +import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; @@ -36,6 +37,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static com.fine.theme.utils.FineUIStyle.OFFET_LEFT_TEXT_FIELD; +import static com.fine.theme.utils.FineUIStyle.PLAIN_ARROW_BUTTON; +import static com.fine.theme.utils.FineUIStyle.TRANSPARENT_TEXT_FIELD; +import static com.fine.theme.utils.FineUIStyle.setStyle; + /** * 设计器下拉复选框组件 * 支持全选、半选 @@ -43,10 +49,10 @@ import java.util.Map; * 可以省略显示 * * @author - * @since - * Created on + * @since Created on */ -public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNameObserver, HoverAware { +public class UIComboCheckBox extends JComboBox implements UIObserver, GlobalNameObserver, HoverAware { + private static final String UI_CLASS_ID = "ComboCheckBoxUI"; //下拉框的值 private Object[] values; //已经选中的值 @@ -55,8 +61,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private List listeners = new ArrayList(); private UICheckListPopup popup; private UITextField editor; + private final JPanel clickPane = new JPanel(new BorderLayout()); private UIButton arrowButton; - private UILabel label; //选中的值之间显示的分隔符 private String valueSperator; private static final String DEFAULT_VALUE_SPERATOR = ","; @@ -71,6 +77,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private String placeHolder = StringUtils.EMPTY; private boolean rollOver; + private boolean popupVisible = false; public UIComboCheckBox(Object[] value) { this(value, DEFAULT_VALUE_SPERATOR, true); @@ -123,19 +130,22 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam } private void initComponent() { - this.popup = new UICheckListPopup(values, supportSelectAll); + this.popup = new UICheckListPopup(values, supportSelectAll) { + @Override + public Dimension getPreferredSize() { + Dimension size = super.getPreferredSize(); + size.width = UIComboCheckBox.this.getWidth(); + return size; + } + }; + this.popup.setBorder(new FineRoundBorder()); this.popup.addActionListener(new PopupAction()); - this.editor = createEditor(); - this.arrowButton = createArrowButton(); - this.label = new UILabel(getIcon()); - label.setPreferredSize(FineUIScale.scale(new Dimension(24, 24))); + initClickPane(); setLayoutAndAddComponents(); setText(); addPopupListener(this); - setBackground(Color.WHITE); - setOpaque(true); } /** @@ -152,8 +162,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam return popup; } - public UITextField getEditor() { - return editor; + public JPanel getClickPane() { + return clickPane; } public String getPlaceHolder() { @@ -164,31 +174,37 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam this.placeHolder = placeHolder; } - public UIButton getArrowButton() { - return arrowButton; - } + private void initClickPane() { + editor = new TextField(); + editor.setEditable(false); + setStyle(editor, OFFET_LEFT_TEXT_FIELD); - public UILabel getLabel() { - return label; - } + arrowButton = new UIButton(getIcon()); + setStyle(arrowButton, PLAIN_ARROW_BUTTON); - private UIButton createArrowButton() { - final UIButton arrowBtn = new UIButton(); - arrowBtn.setNormalPainted(false); - arrowBtn.setPreferredSize(FineUIScale.scale(new Dimension(20, 5))); - arrowBtn.setIcon(getIcon()); - arrowBtn.setExtraPainted(false); - addPopupListener(arrowBtn); + clickPane.add(editor, BorderLayout.CENTER); + clickPane.add(arrowButton, BorderLayout.EAST); - return arrowBtn; + addPopupListener(editor); + addPopupListener(arrowButton); + addHoverStatusListener(editor); + addHoverStatusListener(arrowButton); } - private UITextField createEditor() { - UITextField editor = new TextField(); - editor.setEditable(false); - addPopupListener(editor); + protected void addHoverStatusListener(JComponent component) { + component.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + rollOver = true; + repaint(); + } - return editor; + @Override + public void mouseExited(MouseEvent e) { + rollOver = popup.isVisible(); + repaint(); + } + }); } /** @@ -202,18 +218,6 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam public void mouseClicked(MouseEvent e) { togglePopup(); } - - @Override - public void mouseEntered(MouseEvent e) { - rollOver = true; - repaint(); - } - - @Override - public void mouseExited(MouseEvent e) { - rollOver = false; - repaint(); - } }); } @@ -240,7 +244,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam @Override public boolean isHovered() { - return rollOver || this.popup.isShowing(); + return rollOver; } private class PopupAction implements ActionListener { @@ -258,12 +262,34 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private void togglePopup() { if (this.arrowButton.isEnabled()) { - popup.setBorder(new FineRoundBorder()); - popup.setPreferredSize(new Dimension(getWidth(), this.popup.getPreferredSize().height)); - popup.show(this, 0, getHeight()); + if (popupVisible) { + hidePopup(); + } else { + showPopup(); + } } } + /** + * 展示 popup + */ + public void showPopup() { + this.popup.show(this, 0, getHeight()); + arrowButton.setIcon(new LazyIcon("up_arrow")); + arrowButton.repaint(); + popupVisible = true; + } + + /** + * 隐藏 popup + */ + public void hidePopup() { + popup.setVisible(false); + arrowButton.setIcon(new LazyIcon("down_arrow")); + arrowButton.repaint(); + popupVisible = false; + } + /** * 清除文本框 */ @@ -301,6 +327,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam /** * 为为添加placeholder + * * @param editor */ protected void setEditorPlaceHolder(UITextField editor) { @@ -335,7 +362,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam for (int i = 1; i <= chars.length; i++) { //如果原文本+省略号长度超过文本框 - if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getPreferredSize().getWidth()) { + if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getWidth()) { //从第i-1的位置截断再拼上省略号 omitText = text.substring(0, i - 2) + OMIT_TEXT; break; @@ -466,8 +493,14 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam } } + @Override + public String getUIClassID() { + return UI_CLASS_ID; + } + /** * 简单的测试demo + * * @param args */ public static void main(String args[]) { diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties index 0f74d6f6fb..456d77ac89 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties @@ -5,6 +5,7 @@ CheckBoxUI=com.fine.theme.light.ui.FineCheckBoxUI CheckBoxMenuItemUI=com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI +ComboCheckBoxUI=com.fine.theme.light.ui.FineComboCheckBoxUI DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI CalendarPaneUI=com.fine.theme.light.ui.FineCalendarPaneUI diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 2e97c83ad2..746a5da6f8 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -324,6 +324,10 @@ ComboBox.comboHeight = 24 ComboBox.selectBox.button.height = 22 ComboBox.renderInset = 0,6,0,6 +#---- ComboCheckBox ---- +ComboCheckBox.background = $fill.normal +ComboCheckBox.border = com.fine.theme.light.ui.FineRoundBorder + #---- Component ---- Component.focusWidth = 0 @@ -1276,6 +1280,15 @@ chart.selectedBorderColor = #2576EF borderWidth : 0; \ disabledBackground : fade($Button.background,0%); +[style]Button.plainArrowButton=\ + background : fade($Button.background,0%); \ + margin: 4,4,4,4; \ + borderWidth : 0; \ + disabledBackground : fade($Button.background,0%); \ + hoverBackground : null; \ + selectedBackground : null; \ + pressedBackground : null + [style]CombinationButton.primary = \ background : @BrandColor; \ arc : 3 @@ -1328,6 +1341,11 @@ chart.selectedBorderColor = #2576EF [style]TextField.transparentTextField=\ background: fade(@background, 0%); \ border: null; + +[style]TextField.offsetLeftText=\ + background: fade(@background, 0%); \ + border: 0,6,0,0; + [style]PopupMenu.dropdownPopupMenu=\ background: fade(@background, 0%); \ borderInsets: 0,0,0,0; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java index cecf40a981..75d8058c27 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java @@ -292,12 +292,7 @@ public class DesensitizationCellPane extends BasicBeanPane { protected void setLayoutAndAddComponents() { // 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白 this.setLayout(FRGUIPaneFactory.createBorderLayout()); - UITextField editor = getEditor(); - UIButton arrowButton = getArrowButton(); - setStyle(editor, TRANSPARENT_TEXT_FIELD); - setStyle(arrowButton, PLAIN_BUTTON); - this.add(editor, BorderLayout.CENTER); - this.add(arrowButton, BorderLayout.EAST); + this.add(getClickPane(), BorderLayout.CENTER); } @Override From 36e34a37d74308bed655aa9129c07ad8808780cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 27 Sep 2024 17:08:06 +0800 Subject: [PATCH 03/29] =?UTF-8?q?REPORT-136114=20fix:=E8=80=81=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E9=83=A8=E5=88=86=E9=9D=A2=E6=9D=BF=E7=BF=BB=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/utils/FineLayoutBuilder.java | 2 + .../fr/design/layout/TableLayoutHelper.java | 2 +- .../java/com/fr/design/style/AlphaPane.java | 21 +--- .../chart/axis/ChartAlertValuePane.java | 114 ++++++++---------- .../design/chart/report/GisMapDataPane.java | 23 ++-- .../report/GisMapReportDataContentPane.java | 47 +++----- .../report/GisMapTableDataContentPane.java | 77 +++++------- .../chart/gui/other/ChartInteractivePane.java | 5 +- .../chart/gui/style/ChartAxisLabelPane.java | 110 ++++++----------- .../chart/gui/style/ChartAxisTitlePane.java | 36 ++---- .../style/ChartDataPointLabel4GisPane.java | 32 ++--- .../gui/style/ChartDatapointLabelPane.java | 9 +- .../chart/gui/style/axis/ChartAxisPane.java | 11 ++ .../chart/gui/style/axis/ChartValuePane.java | 32 ++--- .../gui/style/legend/ChartLegendPane.java | 27 ++--- .../chart/gui/style/title/ChartTitlePane.java | 42 ++----- 16 files changed, 235 insertions(+), 355 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java index 7115b3afea..2c46d446ae 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java @@ -6,6 +6,8 @@ import com.fine.swing.ui.layout.Row; import com.fine.swing.ui.layout.Spacer; import com.fr.design.constants.LayoutConstants; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; import com.fr.stable.collections.combination.Pair; diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java index 5e31ba2f7f..e172b9f117 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java @@ -370,7 +370,7 @@ public class TableLayoutHelper { JPanel secondMenu = createTableLayoutPane(components, rowSize, columnSize); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] column = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; + double[] column = {LayoutConstants.HORIZONTAL_GAP, f}; double[] row = {p, p}; StringBuilder resultText = new StringBuilder(); for (String text : title) { diff --git a/designer-base/src/main/java/com/fr/design/style/AlphaPane.java b/designer-base/src/main/java/com/fr/design/style/AlphaPane.java index 4560f84dfd..329fef1b64 100644 --- a/designer-base/src/main/java/com/fr/design/style/AlphaPane.java +++ b/designer-base/src/main/java/com/fr/design/style/AlphaPane.java @@ -1,9 +1,7 @@ package com.fr.design.style; import java.awt.BorderLayout; -import java.awt.Dimension; -import javax.swing.BorderFactory; import javax.swing.JFormattedTextField; import javax.swing.JPanel; import javax.swing.JSlider; @@ -14,6 +12,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.Utils; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; @@ -46,18 +45,11 @@ public class AlphaPane extends JPanel { this.setLayout(FRGUIPaneFactory.createBorderLayout()); // 透明选项 - JPanel alphaPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - alphaPane.setBorder(BorderFactory.createEmptyBorder()); - this.add(alphaPane, BorderLayout.CENTER); - - alphaPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha") + ":")); - - alphaPane.add(alphaSlider = new UISlider(UISlider.HORIZONTAL, 0, ALPHA_FLOAT, START_VALUE)); - alphaSlider.setPreferredSize(new Dimension(80, 20)); - + alphaSlider = new UISlider(UISlider.HORIZONTAL, 0, ALPHA_FLOAT, START_VALUE); valueSpinner = new UIBasicSpinner(new SpinnerListModel(values)); - alphaPane.add(valueSpinner); - + JPanel alphaPane = FineLayoutBuilder.createHorizontalLayout(10, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), + alphaSlider, valueSpinner); + JFormattedTextField field = GUICoreUtils.getSpinnerTextField(valueSpinner); field.setText(checkFormat(START_VALUE)); if (field != null) { @@ -65,9 +57,8 @@ public class AlphaPane extends JPanel { field.setHorizontalAlignment(UITextField.LEFT); field.getDocument().addDocumentListener(textListener); } - - valueSpinner.setPreferredSize(new Dimension(60, 18)); alphaSlider.addChangeListener(changeListener); + this.add(alphaPane, BorderLayout.CENTER); } DocumentListener textListener = new DocumentListener() { diff --git a/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java b/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java index 59250c9725..465d146677 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java @@ -1,5 +1,6 @@ package com.fr.design.chart.axis; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.chartattr.ChartAlertValue; @@ -13,25 +14,31 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.AlphaPane; import com.fr.design.style.FRFontPane; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; -import javax.swing.*; -import java.awt.*; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Font; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; + /** * 图表 坐标轴 警戒线值 编辑界面. (默认 位置居左居右) * @author kunsnat E-mail:kunsnat@gmail.com @@ -55,30 +62,14 @@ public class ChartAlertValuePane extends BasicBeanPane { public ChartAlertValuePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - this.add(pane, BorderLayout.CENTER); - - JPanel alertLinePane =FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - pane.add(alertLinePane); - - alertLinePane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Setting"))); - - JPanel valuePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - alertLinePane.add(valuePane); - - valuePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Value") + ":")); - + + // 警戒线 textField = new UITextField(); - textField.setColumns(4); - valuePane.add(textField); - textField.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showFormulaPane(); } }); - textField.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { e.consume(); @@ -86,34 +77,29 @@ public class ChartAlertValuePane extends BasicBeanPane { } }); - JPanel lineStylePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - alertLinePane.add(lineStylePane); - - lineStylePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style") + ":")); lineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); - lineStylePane.add(lineCombo); - - JPanel lineColorPane =FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - alertLinePane.add(lineColorPane); - - lineColorPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Color") + ":")); colorBox = new ColorSelectBox(80); - lineColorPane.add(colorBox); - alphaPane = new AlphaPane(); - alertLinePane.add(alphaPane); - - JPanel tipPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - pane.add(tipPane); - - tipPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Tip") + ":", null)); - - JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - tipPane.add(centerPane); - + + JPanel alertLinePane = column(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Value"))).weight(1), + cell(textField).weight(4) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style"))).weight(1), + cell(lineCombo).weight(4) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Color"))).weight(1), + cell(colorBox).weight(4) + ), + cell(alphaPane) + ).getComponent(); + + // 提示文字 fontNameBox = new UIComboBox(); - fontNameBox.setPreferredSize(new Dimension(80,20)); - + fontNameBox.addItem("SimSun"); // TODO 这边字体中没有在列表内 String[] names = DesignUtils.getAvailableFontFamilyNames4Report(); for(int i = 0; i < names.length; i++) { @@ -121,25 +107,31 @@ public class ChartAlertValuePane extends BasicBeanPane { } fontSizeBox = new UIComboBox(); - fontSizeBox.setPreferredSize(new Dimension(80,20)); Integer[] sizes = FRFontPane.Font_Sizes; for(int i = 0; i < sizes.length; i++) { fontSizeBox.addItem(sizes[i]); } - - double t = TableLayout.FILL; - double[] rowSize = {t, t, t, t, t}; - double[] columnSize = {0.1, 0.2, 0.5, 0.2}; - Component[][] components= { - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content") + ":"), contentField = new UITextField(3)}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font") + ":"), fontNameBox}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Size") + ":"), fontSizeBox}, - {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout") + ": "), leftButton = new UIRadioButton(getLeftName())}, - {null, null, rightButton = new UIRadioButton(getRightName())}, - + leftButton = new UIRadioButton(getLeftName()); + rightButton = new UIRadioButton(getRightName()); + Component[][] components = { + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content") ), contentField = new UITextField()}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font")), fontNameBox}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Size") ), fontSizeBox}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), + FineLayoutBuilder.createHorizontalLayout(10, leftButton, rightButton)}, + }; - JPanel tablePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - centerPane.add(tablePane); + + JPanel tipPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 4}); + + JPanel pane = column(10, + cell(wrapComponentWithTitle(alertLinePane, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line_Setting") + )), + cell(wrapComponentWithTitle(tipPane, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Tip"))) + ).getComponent(); + this.add(pane, BorderLayout.CENTER); ButtonGroup bg = new ButtonGroup(); bg.add(leftButton); diff --git a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java index ae46f709e6..a503cea781 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapDataPane.java @@ -1,5 +1,7 @@ package com.fr.design.chart.report; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; @@ -7,18 +9,17 @@ import com.fr.chart.chartdata.GisMapReportDefinition; import com.fr.chart.chartdata.GisMapTableDefinition; import com.fr.chart.chartdata.TopDefinition; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.gui.data.DataContentsPane; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; import java.util.ArrayList; import java.util.List; @@ -102,17 +103,13 @@ public class GisMapDataPane extends DataContentsPane{ contentPane.add(dataFromPane = new UIComboBoxPane() { protected void initLayout() { - this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE,6)); + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { p,f }; - double[] rowSize = { p}; Component[][] components = new Component[][]{ - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source") + ":"), jcb}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source")), jcb}, } ; - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + JPanel northPane = FineLayoutBuilder.commonLeftRightLayout(components); this.add(northPane, BorderLayout.NORTH); this.add(cardPane, BorderLayout.CENTER); @@ -134,7 +131,7 @@ public class GisMapDataPane extends DataContentsPane{ } }, BorderLayout.CENTER); - dataFromPane.setBorder(BorderFactory.createEmptyBorder(10 ,0, 0, 0)); + dataFromPane.setBorder(new ScaledEmptyBorder(10 ,0, 0, 0)); return contentPane; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java index 583b0a54fc..7d904136b2 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapReportDataContentPane.java @@ -1,12 +1,12 @@ package com.fr.design.chart.report; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.chartdata.BaseSeriesDefinition; import com.fr.chart.chartdata.GisMapReportDefinition; import com.fr.chart.chartdata.SeriesDefinition; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -17,25 +17,26 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTable; -import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 属性表gis地图单元格数据源设置界面 * @@ -55,37 +56,25 @@ public class GisMapReportDataContentPane extends FurtherBasicBeanPane(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); lnglatOrder = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); addressPane = new DefaultTinyFormulaPane(); addressNamePane = new DefaultTinyFormulaPane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = new double[]{p, f}; - double[] rowSize = new double[]{p, p, p}; - - orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, 0)) { - @Override - public Dimension getPreferredSize() { - if (this.isVisible()) { - return super.getPreferredSize(); - } else { - return new Dimension(0, 0); - } - } - }; - orderPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), BorderLayout.WEST); - orderPane.add(lnglatOrder, BorderLayout.CENTER); + orderPane = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng_Order")), lnglatOrder); orderPane.setVisible(false); lnglatOrder.setSelectedIndex(0); addressType.setSelectedIndex(0); - Component[][] components = new Component[][]{ - new Component[]{addressType, addressPane}, - new Component[]{orderPane, null}, - new Component[]{new UILabel(" " +com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name")+":", SwingConstants.RIGHT), addressNamePane}, - }; - JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel northPane = column(10, + row(10, + cell(addressType).weight(1), cell(addressPane).weight(1) + ), + cell(orderPane), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Address_Name"))).weight(1.2), cell(addressNamePane).weight(3) + ) + ).getComponent(); this.add(northPane, BorderLayout.NORTH); diff --git a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java index 723a91f880..532f9e6b5b 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/report/GisMapTableDataContentPane.java @@ -1,10 +1,10 @@ package com.fr.design.chart.report; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.Utils; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartdata.GisMapTableDefinition; import com.fr.chart.chartdata.SeriesDefinition; -import com.fr.design.constants.LayoutConstants; import com.fr.data.impl.NameTableData; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.beans.FurtherBasicBeanPane; @@ -16,17 +16,20 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; @@ -34,6 +37,10 @@ import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 属性表gis地图数据集数据源定义面板 * @author eason @@ -54,26 +61,20 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_GIS_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); - lnglatOrder = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); + addressType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_GIS_Address"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_LatLng")}); + lnglatOrder = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude_First"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude_First")}); addressType.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -82,22 +83,8 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane implements UIOb Component[][] components = new Component[][]{ new Component[]{isAutoRefresh, null}, - new Component[]{GUICoreUtils.createFlowPane(new Component[]{ + new Component[]{FineLayoutBuilder.createHorizontalLayout(10, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), autoRefreshTime, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Seconds")) - }, 1)}, + )}, new Component[]{new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Support_Img_And_Cell") + ""), null}, }; autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Fine-Design_Chart_Data_Check"}, components, rowSize, columnSize); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java index 390ff1004c..0beb5a3d50 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java @@ -1,12 +1,14 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.swing.ui.layout.Row; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; import com.fr.base.Style; import com.fr.base.Utils; import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.TextAttr; import com.fr.chart.chartattr.Axis; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -16,14 +18,16 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.NumberDragBar; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import javax.swing.*; +import javax.swing.JPanel; +import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -155,33 +159,26 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ } private JPanel getWrapShowWayPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p, p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay, null}, - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, - new Component[]{null, orientationSpinner, orientationBar, null}, - new Component[]{null, textAttrPane, null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose}, + new Component[]{null, createorientionRow()}, + new Component[]{textAttrPane, null, null}, }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components,new double[]{1.2, 3}); } - private JPanel getIntervalShowWayPane() { - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p, p}; + private Row createorientionRow() { + return FineLayoutBuilder.createHorizontalLayout(10, new double[]{1, 1.5}, orientationSpinner, orientationBar); + } + private JPanel getIntervalShowWayPane() { Component[][] components = new Component[][]{ new Component[]{getCombox()}, new Component[]{getTowChoose()}, new Component[]{getOther()} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); } private JPanel getTowChoose() { @@ -192,46 +189,30 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ custom.setSelected(false); customLabelSamleTime.setVisible(true); customLabelSamleTime.setEnabled(false); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; - double[] rowSize = {p, p}; - JPanel customPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{custom, customLabelSamleTime, null}, - }, new double[]{p}, new double[]{p, p, f}); + JPanel customPane = FineLayoutBuilder.createHorizontalLayout(10, custom, customLabelSamleTime); Component[][] components = new Component[][]{ - new Component[]{null, auto,}, - new Component[]{null, customPane} + new Component[]{auto,}, + new Component[]{customPane} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); } private JPanel getCombox() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p}; - Component[][] components = new Component[][]{ - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay, null} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show")), showWay} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.commonLeftRightLayout(components); } private JPanel getOther() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p, p, p}; - Component[][] components = new Component[][]{ - new Component[]{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, - new Component[]{null, orientationSpinner, orientationBar, null}, - new Component[]{null, textAttrPane, null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose}, + new Component[]{null, createorientionRow()}, + new Component[]{textAttrPane, null, null}, }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private void checkShowWay() { @@ -246,18 +227,13 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ } else { labelPane = getWrapShowWayPane(); } - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] row = {p, p}; - double[] col = {f}; - showWayPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + showWayPane = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane); + this.add(showWayPane, BorderLayout.CENTER); this.validate(); } - - private void checkOrientationField() { if (labelOrientationChoose.getSelectedIndex() != 2) { orientationBar.setVisible(false); @@ -283,23 +259,17 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{ customLabelSamleTime.registerChangeListener(this.observerListener); orientationSpinner.registerChangeListener(this.observerListener); labelOrientationChoose.registerChangeListener(this.observerListener); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; - double[] rowSize = {p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelSampleChoose, customLabelSamleTime}, - new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose, null}, - new Component[]{null,orientationSpinner, orientationBar, null}, - new Component[]{null,textAttrPane, null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), + FineLayoutBuilder.createHorizontalLayout(10,labelSampleChoose, customLabelSamleTime)}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")), labelOrientationChoose}, + new Component[]{null, createorientionRow()}, + new Component[]{textAttrPane, null}, }; - labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - - double[] row = {p,p}; - double[] col = {f}; - return TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); + labelPane = FineLayoutBuilder.commonLeftRightLayout(components); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + return FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane); } private void checkCustomSampleField() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java index f2d9446297..59ede28610 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java @@ -1,25 +1,23 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineComponentsFactory; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.Utils; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Title; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.general.FRFont; import com.fr.stable.Constants; import com.fr.stable.StableUtils; -import javax.swing.Icon; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -46,36 +44,26 @@ public class ChartAxisTitlePane extends BasicPane{ axisTitleContentPane = new DefaultTinyFormulaPane(); axisTitleAttrPane = new ChartTextAttrPane(); axisTitleAttrPane.populate(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 9)); - Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; - Integer[] alignment = new Integer[] { Constants.LEFT, Constants.CENTER, Constants.RIGHT }; - titleAlignmentPane = new UIButtonGroup(alignmentIconArray, alignment); + titleAlignmentPane = FineComponentsFactory.createHorizontalAlignmentButtonGroup(); titleAlignmentPane.setSelectedItem(Constants.CENTER); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN, f }; - double[] rowSize = { p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{null,axisTitleContentPane}, - new Component[]{null,axisTitleAttrPane}, - new Component[]{null,new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style"))}, - new Component[]{null,titleAlignmentPane,}, + new Component[]{axisTitleContentPane}, + new Component[]{axisTitleAttrPane}, + new Component[]{FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style")), titleAlignmentPane)}, }; - titlePane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); - + titlePane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1}); + titlePane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + isAxisTitleVisable.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { checkTitleUse(); } }); - double[] row = {p,p}; - double[] col = {f}; this.setLayout(new BorderLayout()); - JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isAxisTitleVisable}, new Component[]{titlePane}}, row, col); + JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isAxisTitleVisable, titlePane); this.add(panel, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java index 6b22c287f5..83caf2986d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java @@ -1,23 +1,24 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Utils; import com.fr.chart.base.AttrContents; import com.fr.chart.base.ChartConstants; import com.fr.chart.base.DataSeriesCondition; -import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.FRFont; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -49,31 +50,18 @@ public class ChartDataPointLabel4GisPane extends ChartDatapointLabelPane{ initFormatListener(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - - double[] columnSize = { p, f }; - double[] rowSize = { p,p,p,p,p,p}; - - JPanel delimiterPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM)); - delimiterPane.add(new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Delimiter_Symbol")), BorderLayout.WEST); - delimiterPane.add(divideComoBox, BorderLayout.CENTER); - Component[][] components = new Component[][]{ new Component[]{isAddress, null}, new Component[]{isAddressName, null}, new Component[]{isAddressTittle, null}, new Component[]{isDatapointValue, valueFormatButton}, - new Component[]{delimiterPane, null}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Delimiter_Symbol")), divideComoBox}, new Component[]{textFontPane, null} }; - labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - - double[] row = {p,p}; - double[] col = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; - JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow,null},new Component[]{null, labelPane}}, row, col); + labelPane = FineLayoutBuilder.commonLeftRightLayout(components); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane); this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER) ; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java index 8e198ea6c5..65cf34c868 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.CoreDecimalFormat; import com.fr.base.FRContext; import com.fr.base.Style; @@ -180,11 +182,8 @@ public class ChartDatapointLabelPane extends BasicPane{ components[6] = new Component[]{textFontPane,null}; labelPane = TableLayoutHelper.createTableLayoutPane(components,rowSize2,columnSize); } - - double[] row = {p,p}; - double[] col = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; - panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLabelShow,null},new Component[]{null, labelPane}}, row, col); + labelPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + panel = FineLayoutBuilder.createVerticalLayout(10, isLabelShow, labelPane ); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER) ; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java index af1af8af31..8c83565d17 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java @@ -6,6 +6,7 @@ import com.fr.design.chart.ChartPlotFactory; import com.fr.design.chart.axis.AxisStyleObject; import com.fr.design.chart.axis.ChartStyleAxisPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.style.ThirdTabPane; @@ -13,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; @@ -28,6 +30,15 @@ public class ChartAxisPane extends ThirdTabPane implements AutoSelectedPa super(plot, parent); } + @Override + protected void initLayout() { + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); + if (!paneList.isEmpty()) { + this.add(tabPane, BorderLayout.NORTH); + } + this.add(centerPane, BorderLayout.CENTER); + } + @Override protected List initPaneList(Plot plot, AbstractAttrNoScrollPane parent) { List paneList = new ArrayList(); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java index 35b57d09d7..80e626d661 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.style.axis; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.base.AxisUnitType; @@ -10,13 +11,11 @@ import com.fr.chart.chartattr.NumberAxis; import com.fr.chart.chartattr.Plot; import com.fr.design.chart.ChartSwingUtils; import com.fr.design.chart.axis.MinMaxValuePane; -import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.FormatPane; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartAxisLabelPane; @@ -34,7 +33,6 @@ import javax.swing.JPanel; import javax.swing.JSeparator; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -153,15 +151,11 @@ public class ChartValuePane extends ChartAxisUsePane{ //构造数据定义界面 private JPanel createDataDefinePane(){ - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN,p,f}; - double[] rowSize = { p, p}; Component[][] component = new Component[][]{ - new Component[]{null,initMinMaxValue(),null}, - new Component[]{null, addLogarithmicPane2ValuePane(), addLogText()}, + new Component[]{initMinMaxValue(),null}, + new Component[]{addLogarithmicPane2ValuePane(), addLogText()}, }; - return TableLayoutHelper.createTableLayoutPane(component, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, component, new double[]{1, 1}); } // 返回最大最小值界面. 雷达轴 有切换按钮. @@ -175,15 +169,13 @@ public class ChartValuePane extends ChartAxisUsePane{ // 返回对数相关界面. 百分比 没有此界面. protected JPanel addLogarithmicPane2ValuePane() { - JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - labelLogPane.add(logBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Logarithmic")+":")); - labelLogPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Log_Base"))); - + logBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Logarithmic")); logBaseField = new UITextField(4); logBaseField.setText("10"); - logBaseField.setPreferredSize(new Dimension(55, 20)); + JPanel labelLogPane = FineLayoutBuilder.createHorizontalLayout(10, logBox, + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Log_Base"))); - logBox.addActionListener(new ActionListener() { + logBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { checkLogUse(); } @@ -195,13 +187,7 @@ public class ChartValuePane extends ChartAxisUsePane{ } private JPanel addLogText() { - JPanel labelLogPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - - if(logBaseField != null) { - labelLogPane.add(logBaseField); - } - - return labelLogPane; + return FineLayoutBuilder.createHorizontalLayout(10, logBaseField); } protected JPanel getAxisTitlePane(){ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java index 4c5a7b6e42..9ec2b0e947 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java @@ -1,15 +1,14 @@ package com.fr.design.mainframe.chart.gui.style.legend; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Legend; import com.fr.chart.chartattr.Plot; -import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; @@ -18,8 +17,11 @@ import com.fr.design.dialog.BasicScrollPane; import com.fr.stable.Constants; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -70,24 +72,17 @@ public class ChartLegendPane extends BasicScrollPane{ location.setAllToolTips(textArray); backgroundPane = new ChartBackgroundNoImagePane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { LayoutConstants.CHART_ATTR_TOMARGIN, f }; - double[] rowSize = { p,p,p,p,p,p}; - Component[][] components = new Component[][]{ - new Component[]{null,textAttrPane}, + new Component[]{textAttrPane}, new Component[]{new JSeparator(),null}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),location} , new Component[]{new JSeparator(),null}, new Component[]{borderPane,null}, new Component[]{backgroundPane,null} }; - legendPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); - double[] col = {f}; - double[] row = {p, p}; - JPanel panel = TableLayoutHelper.createTableLayoutPane(new Component[][]{ - new Component[]{isLegendVisible},new Component[]{legendPane},},row,col); + legendPane = FineLayoutBuilder.commonLeftRightLayout(components); + legendPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + JPanel panel = FineLayoutBuilder.createVerticalLayout(10, isLegendVisible, legendPane); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER); isLegendVisible.addActionListener(new ActionListener() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java index cc3f828098..a76cf5c2f3 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java @@ -1,30 +1,27 @@ package com.fr.design.mainframe.chart.gui.style.title; +import com.fine.theme.utils.FineComponentsFactory; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.chart.base.TextAttr; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Title; -import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.formula.DefaultTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; -import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JSeparator; import java.awt.BorderLayout; @@ -57,16 +54,12 @@ public class ChartTitlePane extends BasicScrollPane { isTitleVisable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Title_Visible")); titlePane = createTitlePane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p}; Component[][] components = new Component[][]{ new Component[]{isTitleVisable}, new Component[]{titlePane} } ; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, components,new double[]{1}); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER); @@ -83,10 +76,6 @@ public class ChartTitlePane extends BasicScrollPane { backgroundPane = new ChartBackgroundNoImagePane(); chartDefaultAttrPane = createDefaultAttrPane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p,p,p,p,p}; Component[][] components = new Component[][]{ new Component[]{chartDefaultAttrPane,null}, new Component[]{new JSeparator(),null}, @@ -94,29 +83,22 @@ public class ChartTitlePane extends BasicScrollPane { new Component[]{backgroundPane,null} } ; - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 0}); } private JPanel createDefaultAttrPane(){ titleContent = new DefaultTinyFormulaPane(); textAttrPane = new ChartTextAttrPane(); - Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; - Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; - alignmentPane = new UIButtonGroup(alignmentIconArray, alignment); + alignmentPane = FineComponentsFactory.createHorizontalAlignmentButtonGroup(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, f}; - double[] rowSize = {p, p,p}; Component[][] components = new Component[][]{ - new Component[]{null,titleContent,null}, - new Component[]{null,textAttrPane,null}, - new Component[]{null,new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style") + ":"),alignmentPane} , + new Component[]{titleContent,null}, + new Component[]{textAttrPane,null}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alignment_Style")), alignmentPane} , } ; - - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + JPanel attrPane = FineLayoutBuilder.commonLeftRightLayout(components); + attrPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + return attrPane; } // 检查标题界面是否可用. From 12b41c4413b9b2f0c110c3dea640088d3545fabd Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Fri, 27 Sep 2024 17:36:54 +0800 Subject: [PATCH 04/29] =?UTF-8?q?REPORT-135680=20fix:fbp=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/web/CustomIconPane.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 86c7700ed4..27962c4082 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -6,6 +6,7 @@ import com.fr.base.GraphHelper; import com.fr.base.Icon; import com.fr.base.IconManager; import com.fr.design.border.FineBorderFactory; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; @@ -419,7 +420,7 @@ public class CustomIconPane extends BasicPane { this.setLayout(FRGUIPaneFactory.createBorderLayout()); UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon")); browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button")); - nameTextField = new UITextField(20); + nameTextField = new UITextField(); nameTextField.setPreferredSize(FineUIScale.createScaleDimension(172, 24)); browseButton.addActionListener(e -> onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this))); @@ -446,16 +447,14 @@ public class CustomIconPane extends BasicPane { showImageLabel = new UILabel(); showImageLabel.setPreferredSize(FineUIScale.createScaleDimension(50, 50)); - JPanel centerPane = column(10, - row( - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")).weight(1.2), - cell(nameTextField).weight(3) + JPanel centerPane = column(LayoutConstants.VERTICAL_GAP, + row(40, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")), + cell(nameTextField) ), - row( - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":")).weight(1.2), - row( - cell(showImageLabel), column(fix(13), cell(browseButton), fix(13)).weight(1) - ).weight(3) + row(40, + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":")), + row(cell(showImageLabel), column(fix(13), cell(browseButton), fix(13)).weight(1)).weight(1) ) ).getComponent(); this.add(centerPane, BorderLayout.WEST); From 80c26a2bdc3ed7105af3a7891eda69fc52e16b5c Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 27 Sep 2024 18:24:00 +0800 Subject: [PATCH 05/29] =?UTF-8?q?REPORT-135879=20=E3=80=90fr-fbp=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E6=AC=A1=E7=AE=A1=E4=BF=9D=E5=AD=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=AD=E5=BF=83=E6=A8=A1=E6=9D=BF=EF=BC=8C=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E6=B2=A1=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authority/JTemplateAuthorityChecker.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java index c0d6247905..e661add2fa 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java @@ -1,29 +1,23 @@ package com.fr.design.mainframe.authority; -import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; -import com.fanruan.config.impl.data.TableDataConfigProviderFactory; -import com.fr.base.CloneCollector; import com.fr.design.dialog.FineJOptionPane; - import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; - import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.user.UserAuthority; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; - import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; - import static javax.swing.JOptionPane.WARNING_MESSAGE; @@ -31,6 +25,7 @@ public class JTemplateAuthorityChecker { JTemplate jTemplate; Set authConnectionNames; Set authDatasetNames; + Set templateDatasetNames; Map checkerMap = new HashMap<>(); Set authFailConnectionNames = new HashSet<>(); Set authFailDatasetNames = new HashSet<>(); @@ -45,7 +40,12 @@ public class JTemplateAuthorityChecker { } private void initAuthNames() { - // 无需获取所有数据集和数据连接了,当前只能获取自己有权限的 + // 无需获取所有服务器数据集和数据连接了,因为当前只能获取自己有权限的,只要拿一下模板数据集就行 + templateDatasetNames = new HashSet<>(); + Iterator tableDataNameIterator = jTemplate.getTarget().getTableDataNameIterator(); + while (tableDataNameIterator.hasNext()) { + templateDatasetNames.add(tableDataNameIterator.next()); + } Map> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName()); if (authNamesMap != null) { //有权限的数据连接名称 @@ -87,6 +87,8 @@ public class JTemplateAuthorityChecker { } } } + // 排除模板数据集的部分 + authFailDatasetNames.removeAll(templateDatasetNames); FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; } From df47e1220ca23ff658398afde47e9b0d44066ab8 Mon Sep 17 00:00:00 2001 From: renekton Date: Fri, 27 Sep 2024 19:59:09 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=E5=8E=BB=E9=99=A4html=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fine/theme/light/ui/FineSliderUI.java | 5 +++++ .../widgettheme/theme/edit/widget/WidgetStyleEditPane.java | 5 +++-- .../com/fine/theme/light/ui/laf/FineLightLaf.properties | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineSliderUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineSliderUI.java index a8f150fb44..43aa163fc8 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineSliderUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineSliderUI.java @@ -50,6 +50,11 @@ public class FineSliderUI extends FlatSliderUI { defaultLabelHeight = FineUIUtils.getAndScaleInt("Slider.labelHeight", DEFAULT_LABEL_HEIGHT); } + @Override + protected Color getTrackColor() { + return trackColor; + } + @Override protected void calculateLabelRect() { diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java index bf6ad6c4fd..b5d3f0f5c4 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java @@ -5,6 +5,7 @@ import com.fr.base.theme.TemplateTheme; import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.frpane.FontSizeComboPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.frpane.UIPercentDragPane; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; @@ -67,7 +68,7 @@ public class WidgetStyleEditPane extends BasicBeanPane< * 控件背景和透明度配置面板 */ protected NewColorSelectBox widgetBgColorSelectBox; - protected UIPercentDragPane widgetBgAlphaDragPane; + protected UINumberDragPaneWithPercent widgetBgAlphaDragPane; /** * 图标颜色 */ @@ -130,7 +131,7 @@ public class WidgetStyleEditPane extends BasicBeanPane< colorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); widgetBgColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); - widgetBgAlphaDragPane = new UIPercentDragPane(); + widgetBgAlphaDragPane = new UINumberDragPaneWithPercent(0, 100, 1); initLineBox(); borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); iconColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 644c474ba0..98fc4d6afb 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -147,6 +147,7 @@ tooltip.normal=#3F506A tooltip.disabled=#A3ADBD hover.deep=#e2fbe6 fill.deep=#F6F9FE +track.normal=#b6babe #---- Button ---- @@ -727,7 +728,7 @@ Slider.trackWidth = 2 Slider.thumbSize = 12,12 Slider.focusWidth=0 Slider.trackValueColor=$brand.normal -Slider.trackColor=$border.divider +Slider.trackColor=$track.normal Slider.thumbColor=$fill.normal Slider.thumbBorderColor=$border.divider Slider.tickColor = @disabledForeground From 7a808fe9873f36925743a550e672072f3429f9a8 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 27 Sep 2024 21:11:37 +0800 Subject: [PATCH 07/29] =?UTF-8?q?REPORT-135657=20=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledata/datacenter/DCTableDataJSBridge.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java b/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java index c5f25d68aa..9cc7b780fc 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java @@ -6,6 +6,7 @@ import com.fr.datacenters.tabledata.bean.DCTableDataBean; import com.fr.datacenters.tabledata.filter.DCFilter; import com.fr.datacenters.tabledata.parameter.DCParameter; import com.fr.design.bridge.exec.JSBridge; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.formula.FormulaFactory; @@ -135,6 +136,16 @@ public class DCTableDataJSBridge { }).setVisible(true); } + /** + * 当前所有数据集名称 + */ + @JSBridge + public void getDatasetNames(final JsFunction callback) { + JxUIPane.DEFAULT_EXECUTOR.submit(() -> + callback.invoke(window, EmbedJson.encode( + DesignTableDataManager.getAllDSNames(DesignTableDataManager.getEditingTableDataSource())))); + } + /** * 解析公式参数 */ From fbaa15f962a62bf5733df2ba7597d5defbb53468 Mon Sep 17 00:00:00 2001 From: renekton Date: Fri, 27 Sep 2024 21:49:07 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=9D=A1=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/light/ui/laf/FineLightLaf.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index b0021e5a4f..34e9f8e3c5 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -147,7 +147,7 @@ tooltip.normal=#3F506A tooltip.disabled=#A3ADBD hover.deep=#e2fbe6 fill.deep=#F6F9FE -track.normal=#b6babe +track.normal=#DADEE7 #---- Button ---- From f22127c6da44bafae5447b0b24ddb33739ccaa4e Mon Sep 17 00:00:00 2001 From: Anner Date: Sun, 29 Sep 2024 09:57:33 +0800 Subject: [PATCH 09/29] =?UTF-8?q?REPORT-135874=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E8=84=B1=E6=95=8F=E8=A7=84=E5=88=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../desensitization/model/UpdateDataWorker.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java index d60e9a2c82..07e7571c93 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java @@ -1,10 +1,8 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; -import com.fr.base.operator.org.OrganizationOperator; -import com.fr.data.desensitize.rule.DesensitizationRuleManager; import com.fr.data.desensitize.rule.base.DesensitizationRule; import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import javax.swing.SwingWorker; import java.util.HashMap; @@ -26,8 +24,8 @@ public class UpdateDataWorker extends SwingWorker, Void> { @Override protected Map doInBackground() { Map result = new HashMap<>(); - Map allRoles = WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization(); - Map> allRules = DesensitizationRuleManager.getInstance().getAllRules(); + Map allRoles = RemoteAuthorityRepository.getInstance().getAllRoles4Desensitization(); + Map> allRules = RemoteAuthorityRepository.getInstance().getAllRoles().getSourceRuleMap(); result.put(ROLE_KEY, allRoles); result.put(RULE_KEY, allRules); From 509142cbef5d0c4db4534df10c63a34629b26e94 Mon Sep 17 00:00:00 2001 From: Anner Date: Sun, 29 Sep 2024 11:14:54 +0800 Subject: [PATCH 10/29] =?UTF-8?q?REPORT-136120=20fix:=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BA=A7=E5=88=AB=E9=9C=80=E8=A6=81=E5=85=A8=E9=83=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/boot/env/DesignEnvComponent.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 2a04889c52..8a6e4bc077 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -11,6 +11,7 @@ import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Supplemental; import com.fanruan.config.ConfigProviderFactory; +import com.fanruan.config.LocalConfigSource; import com.fanruan.config.realm.ConfigRealm; import com.fanruan.dao.context.DBContextProvider; import com.fanruan.dao.context.DBContextStarter; @@ -64,12 +65,12 @@ import com.fr.intelli.record.Focus; import com.fr.intelli.record.FocusInterceptor; import com.fr.intelli.record.PerformancePoint; import com.fr.intelli.record.PerformancePointInterceptor; +import com.fr.invoke.Reflect; import com.fr.io.base.ResourcePaths; import com.fr.io.repository.ResourceRepository; import com.fr.io.repository.ResourceRepositoryWrapper; import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; - import com.fr.record.analyzer.AnalyzerConfiguration; import com.fr.record.analyzer.AnalyzerMutableGroup; import com.fr.record.analyzer.DBMetrics; @@ -81,7 +82,6 @@ import com.fr.security.encryption.SystemEncryptionManager; import com.fr.security.encryption.core.EncryptionScaffold; import com.fr.security.encryption.provider.SecuritySeedProvider; import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey; - import com.fr.stable.StringUtils; import com.fr.stable.db.DBContext; import com.fr.stable.db.properties.FineMicroServicesDBProperties; @@ -102,7 +102,6 @@ import com.fr.transaction.HibernateTransactor; import com.fr.transaction.RemoteTransactor; import com.fr.transaction.TransactorFactory; import com.fr.workspace.WorkContext; -import com.fanruan.config.LocalConfigSource; import com.fr.workspace.server.repository.config.LocalConfigSourceShell; import java.net.URI; @@ -247,9 +246,14 @@ public class DesignEnvComponent { */ private void startLogger() { // 获取本地的日志级别配置 - Log4jConfigFactory.getInstance().setRootLevel(Log4jConfig.getInstance().getRootLevel()); + Level localLogPreferLevel = Log4jConfig.getInstance().getRootLevel(); + // 刷新到本地配置 + Log4jConfigFactory.getInstance().setRootLevel(localLogPreferLevel); URI uri = Log4jUtils.buildUserConfigURI(StringUtils.EMPTY); FRLogger.getLogger().config(uri); + // 刷新到carina的配置,防止 portal service 启动的时候覆盖了 + // 配置对象都是默认都文件读取的,设计器本地启动的阶段反射修改一下 + Reflect.on(Carina.properties(LoggerProperties.class)).set("level", localLogPreferLevel.name()); // 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下 listenConfig(); } From 8b440ef2dd8c1b418170ab8429a2e1ef007e722d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Sun, 29 Sep 2024 17:00:45 +0800 Subject: [PATCH 11/29] =?UTF-8?q?REPORT-136212=20fix:=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=9D=A2=E6=9D=BF=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/chart/ChartIcon.java | 2 +- .../com/fr/design/chart/ChartTypePane.java | 29 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java index 2b51b3b9e4..dee0ee5708 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java @@ -24,7 +24,7 @@ import java.awt.Graphics2D; * 图表的缩略图Icon, 在选择图表类型界面 用到. */ public class ChartIcon implements Icon, XMLable { - private static final int WIDTH = FineUIScale.scale(215); + private static final int WIDTH = FineUIScale.scale(210); private static final int HEIGHT = FineUIScale.scale(100); diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 1cfdde0a19..dd773eea1d 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -7,6 +7,7 @@ import com.fine.swing.ui.layout.Column; import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.chart.chartattr.ChartCollection; @@ -24,7 +25,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.van.chart.config.DefaultStyleHelper4Van; -import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JLayer; @@ -74,6 +74,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven JLayer typeScrollPane = FineUIUtils.createCollapsibleScrollBarLayer(mainTypeList); iconViewList = new JList(); + iconViewList.setBorder(null); iconListModel = new DefaultListModel(); iconViewList.setModel(iconListModel); @@ -104,20 +105,20 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven ChartIcon chartIcon = (ChartIcon) value; UILabel centerImg = new UILabel(chartIcon); UILabel text = new UILabel(getChartName(chartIcon), SwingConstants.CENTER); - - Column component = column( - fix(5), - cell(centerImg), cell(text), - fix(5) - ).getComponent(); - Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor") - : FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor"); + Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor") : + FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor"); + Color fillColor = FlatUIUtils.getUIColor("fill.normal", Color.WHITE); UIRoundedBorder roundedBorder = new UIRoundedBorder(borderColor, 1, 5); - component.setBorder(BorderFactory.createCompoundBorder( - new ScaledEmptyBorder(0, 10, 10, 0), roundedBorder)); - component.setBackground(Color.WHITE); - return component; - + Column component = column( + fix(5), cell(centerImg), cell(text), fix(5) + ).with(it -> { + it.setOpaque(true); + it.setBorder(roundedBorder); + it.setBackground(fillColor); + }).getComponent(); + JPanel pane = FineLayoutBuilder.asBorderLayoutWrapped(component); + pane.setBorder(new ScaledEmptyBorder(0, 10, 10, 0)); + return pane; } return this; } From 7f61b231e526f59f941079189a473a0f810a7612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Sun, 29 Sep 2024 17:02:50 +0800 Subject: [PATCH 12/29] =?UTF-8?q?REPORT-135996=20fix:=20=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E9=AA=8C=E6=94=B6=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/utils/FineComponentsFactory.java | 30 +++++++++++++++++++ .../com/fr/design/gui/style/FormatPane.java | 16 ++-------- .../fr/design/gui/style/TextFormatPane.java | 19 ++---------- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java index 80cc69c932..2e8e71d393 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java @@ -1,12 +1,22 @@ package com.fine.theme.utils; import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.data.core.FormatField; +import com.fr.design.border.UIRoundedBorder; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.stable.Constants; +import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JPanel; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; + +import java.awt.Color; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.flex; @@ -62,4 +72,24 @@ public class FineComponentsFactory { flex(), cell(confirmButton), cell(cancelButton)).getComponent(); } + /** + * 创建示例文本,圆角边框&浅灰背景 + * + * @return 示例文本Label + */ + public static UILabel createSampleLabel() { + Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); + Border interBorder = new UIRoundedBorder(labelColor, 0, 4); + + Border border = BorderFactory.createTitledBorder(interBorder, Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"), + TitledBorder.ABOVE_TOP, 0, null, labelColor); + + UILabel sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); + sampleLabel.setHorizontalAlignment(UILabel.CENTER); + sampleLabel.setBorder(BorderFactory.createCompoundBorder(border, new ScaledEmptyBorder(2, 0, 8, 0))); + FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP); + + return sampleLabel; + } + } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index 8ab812e9dc..7d3f7d5a9b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -1,9 +1,9 @@ package com.fr.design.gui.style; +import com.fine.theme.utils.FineComponentsFactory; import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; -import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; import com.fr.base.Style; import com.fr.base.TextFormat; @@ -12,8 +12,6 @@ import com.fr.data.core.FormatField.FormatContents; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; -import com.fr.design.border.UIRoundedBorder; -import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.gui.icombobox.TextFontComboBox; @@ -28,13 +26,10 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.math.RoundingMode; -import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.SwingConstants; -import javax.swing.border.Border; -import javax.swing.border.TitledBorder; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.text.Format; @@ -161,14 +156,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse } private void initSampleLabel() { - Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); - Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); - String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); - Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, labelColor); - sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()); - sampleLabel.setHorizontalAlignment(UILabel.CENTER); - sampleLabel.setBorder(border); - FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP); + sampleLabel = FineComponentsFactory.createSampleLabel(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index a86bc70e05..e2d65aa91c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -1,15 +1,13 @@ package com.fr.design.gui.style; +import com.fine.theme.utils.FineComponentsFactory; import com.fine.theme.utils.FineUIStyle; -import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; import com.fr.base.Style; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; -import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.LayoutConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserverListener; @@ -22,17 +20,11 @@ import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.UIManager; -import javax.swing.border.Border; -import javax.swing.border.TitledBorder; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.FontMetrics; -import java.awt.Graphics; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.math.RoundingMode; @@ -112,14 +104,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName } private void initPreviewLabel4GeneralFormat() { - Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); - Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 0, 4); - String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); - Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.ABOVE_TOP, 0, null, labelColor); - previewLabel = new UILabel(FormatField.getInstance().getFormatValue()); - previewLabel.setHorizontalAlignment(UILabel.CENTER); - previewLabel.setBorder(border); - FineUIStyle.setStyle(previewLabel, FineUIStyle.LABEL_TIP); + previewLabel = FineComponentsFactory.createSampleLabel(); } protected void initLayout() { From bfdd0b52bdf76c13fcf801c061c2d5d244c26050 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 16:28:42 +0800 Subject: [PATCH 13/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4FileNod?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/LocalePane.java | 7 +++--- .../fr/design/file/TemplateDirTreePane.java | 4 ++-- .../com/fr/design/file/TemplateTreePane.java | 2 +- .../file/impl/DefaultTemplateResource.java | 3 +-- .../gui/itree/filetree/EnvFileTree.java | 10 ++++---- .../itree/filetree/FileNodeComparator.java | 3 +-- .../gui/itree/filetree/FileNodeConstants.java | 3 +-- .../gui/itree/filetree/TemplateDirTree.java | 5 ++-- .../gui/itree/filetree/TemplateFileTree.java | 5 ++-- .../DesignerFrameFileDealerPane.java | 4 +--- .../com/fr/design/mainframe/JTemplate.java | 3 +-- .../java/com/fr/file/FILEChooserPane.java | 3 +-- .../main/java/com/fr/file/FileNodeFILE.java | 4 ++-- .../transform/ui/TransformFileTree.java | 14 +++++------ .../boot/init/DesignWorkContextComponent.java | 18 ++++++++------- .../manager/impl/FileSearchManager.java | 23 +++++-------------- 16 files changed, 45 insertions(+), 66 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java index 634af28b9e..c97bd629d5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java @@ -4,14 +4,14 @@ package com.fr.design.actions.file; -import com.fr.base.FRContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.file.filetree.FileNode; import com.fr.general.GeneralUtils; - import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -153,8 +153,7 @@ public class LocalePane extends BasicPane { } private void initCustomProperties() throws Exception { - - FileNode[] fileNodes = FRContext.getFileNodes().list(ProjectConstants.LOCALE_NAME); + FileNode[] fileNodes = TemplateRepository.getInstance().list(new TemplateListBean(ProjectConstants.LOCALE_NAME)); if (ArrayUtils.getLength(fileNodes) == 0) { return; } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java index 1a9fec015c..1145616e9f 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java @@ -1,6 +1,6 @@ package com.fr.design.file; -import com.fr.base.FRContext; +import com.fanruan.repository.TemplateRepository; import com.fr.design.border.FineBorderFactory; import com.fr.design.gui.itree.filetree.TemplateDirTree; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; @@ -74,7 +74,7 @@ public class TemplateDirTreePane extends JPanel { * 刷新 */ public void refreshDockingView() { - templateDirTree.setFileNodeFilter(new IOFileNodeFilter(FRContext.getFileNodes().getSupportedTypes())); + templateDirTree.setFileNodeFilter(new IOFileNodeFilter(TemplateRepository.getInstance().getSupportedTypes())); templateDirTree.refreshEnv(); } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index d15c65f241..4eb45fface 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -63,7 +63,7 @@ import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import com.fr.workspace.server.vcs.VcsOperator; import org.jetbrains.annotations.Nullable; diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java index 96f01f231f..5c4766adc5 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java @@ -2,8 +2,7 @@ package com.fr.design.file.impl; import com.fr.file.FILE; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import java.io.ByteArrayInputStream; import java.io.InputStream; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 1a14821d00..1d5405bd89 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -1,6 +1,7 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.RefreshableJTree; import com.fr.design.i18n.Toolkit; @@ -11,13 +12,12 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.repository.template.TemplateRepository; -import javax.swing.JTree; +import javax.swing.*; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; -import java.awt.Component; +import java.awt.*; import java.io.File; import java.util.Arrays; import java.util.HashMap; @@ -188,7 +188,7 @@ public class EnvFileTree extends RefreshableJTree { FileNode[] resFns = null; try { - resFns = WorkContext.getCurrent() == null ? new FileNode[0] : FRContext.getFileNodes().list(filePath); + resFns = WorkContext.getCurrent() == null ? new FileNode[0] : TemplateRepository.getInstance().list(new TemplateListBean(filePath)); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java index 1429aac3e0..32cad14b5e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java @@ -1,8 +1,7 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.file.filetree.FileNode; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import java.io.Serializable; import java.util.Arrays; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java index 242865aeca..13d1d2490f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java @@ -1,6 +1,5 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext; @@ -10,7 +9,7 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.report.ExtraReportClassManager; import com.fr.report.fun.ReportSupportedFileProvider; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import java.util.Arrays; import java.util.LinkedHashSet; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java index 82f7bc3269..57bd2170af 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java @@ -1,11 +1,10 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.mainframe.manager.search.TemplateDirTreeSearchManager; import com.fr.file.filetree.FileNode; -import com.fr.workspace.server.entity.template.TemplateListBean; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import java.util.Arrays; import java.util.Map; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java index ad36be8cd4..b939e3d9d9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -1,6 +1,5 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.design.ExtraDesignClassManager; import com.fr.design.file.NodeAuthProcessor; @@ -13,8 +12,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.collections.CollectionUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.server.entity.template.TemplateListBean; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import javax.swing.text.Position; import javax.swing.tree.DefaultTreeModel; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 264cfc0016..c996e12622 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -52,7 +52,6 @@ import com.fr.event.Event; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -67,8 +66,7 @@ import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; -import com.fr.report.lock.LockInfoOperator; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.BorderFactory; import javax.swing.JDialog; 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 e280028646..4fba7b581d 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 @@ -101,9 +101,8 @@ import com.fr.stable.core.UUID; import com.fr.widgettheme.designer.WidgetThemeDisplayAction; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; -import com.fr.workspace.server.repository.WorkplaceConstants; import com.fr.workspace.server.repository.connection.ConnectionRepository; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.BorderFactory; import javax.swing.Icon; diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 8ca9918274..06620ba719 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -22,7 +22,6 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.NodeAuthProcessor; import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.DefaultCompletionFilter; @@ -55,7 +54,7 @@ import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.AbstractAction; import javax.swing.AbstractListModel; diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index 72570935a9..168a3c315a 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -23,9 +23,9 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.server.entity.WorkResourceTempRenameStream; -import com.fr.workspace.server.entity.template.TemplateListBean; +import com.fanruan.entity.template.TemplateListBean; import com.fr.workspace.server.repository.system.WorkspaceSystemInfo; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.*; import java.io.InputStream; diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java index cbfcd253fc..f73a6d4870 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java @@ -1,6 +1,7 @@ package com.fr.nx.app.designer.transform.ui; -import com.fr.base.FRContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import com.fr.base.extension.FileExtension; import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeCellRenderer; @@ -10,13 +11,12 @@ import com.fr.design.remote.ui.tree.FileAuthorityTree; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.nx.app.designer.transform.BatchTransformUtil; +import com.fr.stable.StringUtils; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; -import java.awt.AlphaComposite; -import java.awt.Graphics; -import java.awt.Graphics2D; +import java.awt.*; import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -166,10 +166,8 @@ public class TransformFileTree extends FileAuthorityTree { for (String temp : this.filter.getSupportedTypes()) { supportTypes.add(FileExtension.parse(temp)); } - FileNode[] fileNodes = FRContext.getFileNodes().list( - path, - supportTypes.toArray(new FileExtension[supportTypes.size()]) - ); + TemplateListBean bean = new TemplateListBean(path, StringUtils.EMPTY, supportTypes.toArray(new FileExtension[supportTypes.size()]), false, true, false); + FileNode[] fileNodes = TemplateRepository.getInstance().list(bean); return BatchTransformUtil.filterTransformedFile(fileNodes, transformedList); } diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 1756a1952c..7f4f976ce8 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -1,5 +1,6 @@ package com.fanruan.boot.init; +import com.fanruan.boot.RepositorySourceRegister; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; @@ -7,18 +8,14 @@ import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Supplemental; import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup; +import com.fanruan.repository.TemplateRepository; import com.fanruan.workplace.conetxt.CompatiblePool; import com.fanruan.workplace.http.HttpConstants; import com.fanruan.workplace.http.RepositoryManager; import com.fanruan.workplace.http.WorkspaceHeartBeatShell; import com.fanruan.workplace.http.exception.DefaultRemoteExceptionHandler; -import com.fr.report.UnLockedHandler; -import com.fr.workspace.engine.exception.RemoteDesignLoginLockHandler; -import com.fr.workspace.engine.exception.RemoteDesignNoAuthHandler; -import com.fr.workspace.engine.exception.RemoteDesignPasswordNeedUpdateHandler; -import com.fr.workspace.engine.exception.RemoteDesignPasswordStrengthHandler; -import com.fr.workspace.engine.exception.RemoteDesignUserPwdErrorHandler; import com.fanruan.workplace.http.exception.RemoteExceptionConvert; +import com.fanruan.workplace.network.RemoteNetworkRepository; import com.fanruan.workplace.standard.ServerInfo; import com.fanruan.workplace.standard.ServerInfoOperator; import com.fr.base.io.FileAssistUtils; @@ -38,6 +35,7 @@ import com.fr.file.filetree.FileNodes; import com.fr.file.filetree.LocalFileNodes; import com.fr.general.build.BuildInfoOperator; import com.fr.general.build.impl.BuildInfoOperatorImpl; +import com.fr.report.UnLockedHandler; import com.fr.security.encryption.storage.StorageEncryptors; import com.fr.security.encryption.storage.StorageTransfer; import com.fr.stable.StringUtils; @@ -50,6 +48,11 @@ import com.fr.workspace.engine.FineWorkspaceFactory; import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.client.heartbeart.FineWorkspaceHeartbeat; import com.fr.workspace.engine.client.heartbeart.WorkspaceHeartbeat; +import com.fr.workspace.engine.exception.RemoteDesignLoginLockHandler; +import com.fr.workspace.engine.exception.RemoteDesignNoAuthHandler; +import com.fr.workspace.engine.exception.RemoteDesignPasswordNeedUpdateHandler; +import com.fr.workspace.engine.exception.RemoteDesignPasswordStrengthHandler; +import com.fr.workspace.engine.exception.RemoteDesignUserPwdErrorHandler; import com.fr.workspace.engine.exception.RemoteDriverUnExistHandler; import com.fr.workspace.engine.exception.RemoteProcedureErrorHandler; import com.fr.workspace.engine.resource.FineWorkResource; @@ -60,7 +63,6 @@ import com.fr.workspace.resource.WorkResource; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; -import com.fanruan.workplace.network.RemoteNetworkRepository; import com.fr.workspace.server.repository.config.ConfigRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.plugin.PluginRepository; @@ -68,7 +70,6 @@ import com.fr.workspace.server.repository.resource.PublicResourceRepository; import com.fr.workspace.server.repository.resource.WorkResourceRepository; import com.fr.workspace.server.repository.system.SystemInfoRepository; import com.fr.workspace.server.repository.tabledata.TableDataRepository; -import com.fr.workspace.server.repository.template.TemplateRepository; import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.repository.widget.ShareRepository; @@ -94,6 +95,7 @@ public class DesignWorkContextComponent { public void prepare() { supplementalExtra(); supplementalCommon(); + RepositorySourceRegister.registerRepositorySource(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 5f358bbb5e..a5ed74e5fc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.alphafine.search.manager.impl; -import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineConstants; @@ -12,14 +11,12 @@ import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.file.filetree.FileNode; -import com.fr.file.filetree.FileNodes; import com.fr.general.ComparatorUtils; import com.fr.json.JSONObject; -import com.fr.rpc.ExceptionHandler; -import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import java.util.List; @@ -83,12 +80,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { return lessModelList; } AlphaFineHelper.checkCancel(); - fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { - @Override - public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { - return FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true); - } - }).list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true, false); + TemplateListBean bean = new TemplateListBean(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY, AlphaFineConstants.FILE_EXTENSIONS, true, false, false); + fileNodes = TemplateRepository.getInstance().list(bean); isContainCpt = true; isContainFrm = true; doSearch(this.searchText); @@ -161,12 +154,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { */ private void doFileContentSearch(String searchText) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { - FileNode[] fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { - @Override - public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { - return FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); - } - }).filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false); + TemplateListBean bean = new TemplateListBean(ProjectConstants.REPORTLETS_NAME, searchText, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false, false); + FileNode[] fileNodes = TemplateRepository.getInstance().filterFiles(bean); for (FileNode node : fileNodes) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) { From c1e1ae1697da058b1b18ac70c08a1a70c4cf10ce Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:03:00 +0800 Subject: [PATCH 14/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4TableDa?= =?UTF-8?q?taOperator=E5=92=8CConnectionOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/boot/init/DesignWorkContextComponent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 7f4f976ce8..8c679a2b79 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -61,7 +61,6 @@ import com.fr.workspace.pool.WorkRPCRegister; import com.fr.workspace.pool.WorkRPCType; import com.fr.workspace.resource.WorkResource; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; import com.fr.workspace.server.repository.config.ConfigRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; From b2b7dc484be22ca29231cd9ef4eba5a58ec5a7cf Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:05:20 +0800 Subject: [PATCH 15/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4ShareEm?= =?UTF-8?q?beddedConverter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/generate/task/ComponentCreator.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java index ed1c2a91db..75f7def2d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java @@ -5,13 +5,13 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeConfig; +import com.fr.data.TableDataSource; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor; import com.fr.form.main.Form; import com.fr.form.main.WidgetGatherAdapter; import com.fr.form.share.DefaultSharableWidget; -import com.fr.form.share.ShareEmbeddedConverter; import com.fr.form.share.bean.ComponentReuBean; import com.fr.form.share.editor.DefaultSharableEditor; import com.fr.form.share.editor.PlainSharableEditor; @@ -21,11 +21,14 @@ import com.fr.form.ui.Widget; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.fun.IOFileAttrMark; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.tabledata.PreviewSourceBean; +import com.fr.workspace.server.entity.tabledata.TableDataBean; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; /** @@ -112,8 +115,7 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor { //内置数据集 if (tpl != null) { - ShareEmbeddedConverter embeddedConverter = WorkContext.getCurrent().get(ShareEmbeddedConverter.class); - Map map = embeddedConverter.convertToEmbeddedTableData(tpl, paraMap); + Map map = convertToEmbeddedTableData(tpl, paraMap); Iterator> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); @@ -123,6 +125,16 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor { return tpl; } + private Map convertToEmbeddedTableData(TableDataSource tableDataSource, Map parameterMap) throws Exception { + PreviewSourceBean bean = new PreviewSourceBean(tableDataSource, StringUtils.EMPTY, parameterMap , -1, -1 ,new String[0], new int[0]); + List beanList = TableDataRepository.getInstance().convertToEmbeddedTableData(bean); + Map ans = new HashMap<>(); + for (TableDataBean tableDataBean : beanList) { + ans.put(tableDataBean.getName(), tableDataBean.getTableData()); + } + return ans; + } + @NotNull protected DefaultSharableEditor createSharableEditor(Form form, Map paraMap, Widget widget, DefaultSharableWidget info) { From e7cc3647f4c698bb3f0ad8e27e774eaaa35f29d2 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:24:21 +0800 Subject: [PATCH 16/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4LockInf?= =?UTF-8?q?oOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/lock/TemplateLockInfoReSave.java | 4 +-- .../DesignerFrameFileDealerPane.java | 19 +++---------- .../fr/design/mainframe/ForbiddenPane.java | 27 +++++-------------- .../boot/init/DesignWorkContextComponent.java | 2 -- 4 files changed, 13 insertions(+), 39 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java b/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java index f1f927abb1..7eda9b222e 100644 --- a/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java +++ b/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java @@ -1,12 +1,12 @@ package com.fr.design.lock; +import com.fanruan.repository.TemplateRepository; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.JTemplate; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.log.FineLoggerFactory; -import com.fr.report.lock.LockInfoOperator; import com.fr.stable.collections.CollectionUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; @@ -31,7 +31,7 @@ public class TemplateLockInfoReSave { return; } String[] paths = templates.stream().map(JTemplate::getPath).toArray(String[]::new); - String[] lockedPath = WorkContext.getCurrent().get(LockInfoOperator.class).lockTemplates(paths); + String[] lockedPath = TemplateRepository.getInstance().lockTemplates(paths); FineLoggerFactory.getLogger().warn("template lock failed:{}", String.join(";", lockedPath)); } }; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index c996e12622..d0ad936913 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fanruan.repository.TemplateRepository; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIStyle; @@ -58,7 +59,6 @@ import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import com.fr.report.lock.LockInfoOperator; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -66,21 +66,10 @@ import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; -import com.fanruan.repository.TemplateRepository; - -import javax.swing.BorderFactory; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -250,7 +239,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); if (option == JOptionPane.YES_OPTION) { String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath()); - boolean success = WorkContext.getCurrent().get(LockInfoOperator.class).unLockTpl(path); + boolean success = TemplateRepository.getInstance().unLockTpl(path); if (success) { FileNode fileNode = TemplateTreePane.getInstance().getFileNode(); refreshRightToolBarBy(fileNode); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java index 482986241b..e6fe5eed68 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fanruan.repository.TemplateRepository; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.DesignSizeI18nManager; @@ -8,25 +9,10 @@ import com.fr.design.mainframe.guide.base.GuideView; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.report.lock.LockInfoOperator; -import com.fr.workspace.WorkContext; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.LayoutManager; -import java.awt.RenderingHints; +import com.fr.workspace.base.UserInfo; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -125,7 +111,8 @@ public class ForbiddenPane extends JPanel { @Override protected Boolean doInBackground() throws Exception { - return WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(template.getEditingFILE().getPath()); + UserInfo info = TemplateRepository.getInstance().showLockInfo(template.getEditingFILE().getPath()); + return info.getTplLocked(); } @Override diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 8c679a2b79..78dc3902b0 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -28,7 +28,6 @@ import com.fr.design.env.HttpWorkspaceConnector; import com.fr.env.operator.CommonOperatorImpl; import com.fr.esd.core.remote.ESDConfigEventOperator; import com.fr.esd.core.remote.ESDConfigEventOperatorImpl; -import com.fr.file.ConnectionOperator; import com.fr.file.TableDataOperator; import com.fr.file.TableDataOperatorImpl; import com.fr.file.filetree.FileNodes; @@ -178,7 +177,6 @@ public class DesignWorkContextComponent { WorkRPCRegister.wrap(WorkRPCType.Compatible, TableDataOperator.class, TableDataOperatorImpl.getInstance()), WorkRPCRegister.wrap(FileAssistUtilsOperator.class, new FileAssistUtils()), WorkRPCRegister.wrap(TableDataOperator.class, TableDataOperatorImpl.getInstance()), - WorkRPCRegister.wrap(ConnectionOperator.class, CompatibleConnectionOperator.getInstance()), WorkRPCRegister.wrap(BuildInfoOperator.class, new BuildInfoOperatorImpl()) ); } From 9cbdb70f458c18f622488162ba955073faf75b48 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:33:32 +0800 Subject: [PATCH 17/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4DataFet?= =?UTF-8?q?cher,CommitHelper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/javascript/EmailPane.java | 4 +--- .../main/java/com/fanruan/boot/env/DesignEnvComponent.java | 4 +--- .../com/fanruan/boot/init/DesignWorkContextComponent.java | 2 +- .../src/main/java/com/fanruan/config/LocalConfigSource.java | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java b/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java index 22a1e3378c..2b7f72fa36 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java @@ -1,8 +1,6 @@ package com.fr.design.javascript; -import com.fr.base.email.EmailCenter; import com.fine.theme.utils.FineUIStyle; -import com.fr.config.EmailServerConfig; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.constants.UIConstants; import com.fr.design.gui.icheckbox.UICheckBox; @@ -13,7 +11,7 @@ import com.fr.design.layout.TableLayout; import com.fr.js.EmailJavaScript; import com.fr.stable.StringUtils; -import com.fr.workspace.server.repository.config.ConfigRepository; +import com.fanruan.repository.ConfigRepository; import javax.swing.BorderFactory; import javax.swing.JComponent; diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 2a04889c52..385e0122be 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -2,7 +2,6 @@ package com.fanruan.boot.env; import com.fanruan.boot.FSProperties; import com.fanruan.boot.KVProperties; -import com.fanruan.boot.LoggerProperties; import com.fanruan.boot.SchedulerCoreComponent; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.FineComponent; @@ -89,7 +88,6 @@ import com.fr.stable.db.session.DBSession; import com.fr.stable.project.ProjectConstants; import com.fr.tenant.context.TenantContext; import com.fr.tenant.context.provider.CurrentTenantKey; -import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.core.config.Configurator; import com.fr.third.net.bytebuddy.implementation.MethodDelegation; import com.fr.third.net.bytebuddy.matcher.ElementMatchers; @@ -103,7 +101,7 @@ import com.fr.transaction.RemoteTransactor; import com.fr.transaction.TransactorFactory; import com.fr.workspace.WorkContext; import com.fanruan.config.LocalConfigSource; -import com.fr.workspace.server.repository.config.LocalConfigSourceShell; +import com.fanruan.repository.LocalConfigSourceShell; import java.net.URI; import java.sql.Connection; diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 78dc3902b0..dfba3b1279 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -61,7 +61,7 @@ import com.fr.workspace.pool.WorkRPCType; import com.fr.workspace.resource.WorkResource; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; -import com.fr.workspace.server.repository.config.ConfigRepository; +import com.fanruan.repository.ConfigRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.plugin.PluginRepository; import com.fr.workspace.server.repository.resource.PublicResourceRepository; diff --git a/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java b/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java index 11301e93c1..49c27ac2a0 100644 --- a/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java +++ b/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java @@ -1,7 +1,7 @@ package com.fanruan.config; import com.fr.base.email.EmailCenter; -import com.fr.workspace.server.repository.config.BaseConfigSource; +import com.fanruan.repository.BaseConfigSource; /** * 本地配置资源 From be719446bfdad7affae5baacb44b902d53a8b7d5 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:37:31 +0800 Subject: [PATCH 18/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4VcsAuto?= =?UTF-8?q?CleanOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 44 +++++-------------- .../vcs/VcsRecycleSettingHelper.java | 8 ++-- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 1779ef20c1..1babe368ec 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -35,7 +35,6 @@ import com.fr.design.gui.iprogressbar.UIProgressBarUI; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; -import com.fr.design.jdk.JdkVersion; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.vcs.VcsConfigManager; @@ -55,7 +54,6 @@ import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.ReportConfigManager; import com.fr.stable.Constants; -import com.fr.stable.os.OperatingSystem; import com.fr.third.apache.logging.log4j.Level; import com.fr.third.guava.collect.BiMap; import com.fr.third.guava.collect.HashBiMap; @@ -63,38 +61,19 @@ import com.fr.transaction.Configurations; import com.fr.transaction.Worker; import com.fr.transaction.WorkerAdaptor; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.vcs.VcsTaskBean; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsConfig; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.git.config.GcConfig; -import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import org.jetbrains.annotations.NotNull; -import javax.swing.BoxLayout; -import javax.swing.ButtonGroup; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.KeyStroke; -import javax.swing.ScrollPaneConstants; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import javax.swing.Timer; -import javax.swing.UIManager; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.Window; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -110,12 +89,9 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.ExecutionException; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.fix; -import static com.fine.swing.ui.layout.Layouts.row; -import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.swing.ui.layout.Layouts.*; import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; import static com.fr.design.i18n.Toolkit.i18nText; @@ -541,7 +517,7 @@ public class PreferencePane extends BasicPane { new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - return WorkContext.getCurrent().get(VcsAutoCleanOperator.class).isSupport(); + return VcsRepository.getInstance().isSupport(); } @Override protected void done() { @@ -1175,12 +1151,12 @@ public class PreferencePane extends BasicPane { if (useVcsAutoCleanScheduleCheckBox.isEnabled()) { if (useVcsAutoCleanScheduleCheckBox.isSelected()) { FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( + VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean( VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, getDay(autoCleanIntervalComboBox.getSelectedIndex()), - VcsAutoCleanSchedule.class); + VcsAutoCleanSchedule.class)); } else { - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); + VcsRepository.getInstance().stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java index 3e6a5bab96..db93616342 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java @@ -3,9 +3,9 @@ package com.fr.design.mainframe.vcs; import com.fr.concurrent.NamedThreadFactory; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerAdaptor; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.vcs.VcsTaskBean; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsConfig; -import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoRecycleSchedule; @@ -39,10 +39,10 @@ public class VcsRecycleSettingHelper { VcsConfig.getInstance().setV2CleanRecycleInterval(day); } }); - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( + VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean( VcsAutoCleanService.VCS_AUTO_CLEAN_RECYCLE_JOB_NAME, 1, - VcsAutoRecycleSchedule.class); + VcsAutoRecycleSchedule.class)); } }); } From 4107751f056a47276c328122004a7df6a9c77570 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:39:13 +0800 Subject: [PATCH 19/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Templat?= =?UTF-8?q?eChecker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/check/CheckButton.java | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java index e95a105d57..9332368881 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java @@ -1,32 +1,22 @@ package com.fr.design.mainframe.check; +import com.fanruan.repository.TemplateRepository; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.BaseUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; -import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.rpc.ExceptionHandler; -import com.fr.rpc.RPCInvokerExceptionInfo; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.check.TemplateChecker; -import javax.swing.BoxLayout; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -34,14 +24,9 @@ import java.awt.event.WindowEvent; import java.util.Set; import java.util.concurrent.ExecutionException; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.flex; -import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.*; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.*; public class CheckButton extends UIButton { @@ -174,16 +159,15 @@ public class CheckButton extends UIButton { private Set check(JTemplate jtemplate) { String path = jtemplate.getEditingFILE().getEnvFullName(); - Set fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler() { - - @Override - public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { - imageLabel.setIcon(new LazyIcon("error", 20)); - message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); - okButton.setEnabled(true); - return null; - } - }).checkFont(path); + Set fontSet = null; + try { + fontSet = TemplateRepository.getInstance().checkFont(path); + } catch (Exception e) { + imageLabel.setIcon(new LazyIcon("error", 20)); + message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); + okButton.setEnabled(true); + return null; + } return fontSet; } From 26a22893b39f1193f47f049ac902f098b6567d49 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:41:06 +0800 Subject: [PATCH 20/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Organiz?= =?UTF-8?q?ationOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/TableDataDesensitizationTablePane.java | 12 ++++-------- .../com/fr/design/roleAuthority/RoleDataWrapper.java | 2 +- .../desensitization/model/UpdateDataWorker.java | 7 +++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java index 6473a02d07..870dc7ff5b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java @@ -1,6 +1,5 @@ package com.fr.design.data.datapane.preview.desensitization.view.setting; -import com.fr.base.operator.org.OrganizationOperator; import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.TableDataDesensitizationItem; import com.fr.data.desensitize.rule.DesensitizationRuleManager; @@ -11,13 +10,10 @@ import com.fr.design.data.tabledata.tabledatapane.loading.TipsPane; import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.log.FineLoggerFactory; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.JPanel; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Component; +import javax.swing.*; +import java.awt.*; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -91,7 +87,7 @@ public class TableDataDesensitizationTablePane extends JPanel { // 获取当前数据集的所有列名 columnNames.addAll(TableDataPreviewDesensitizeManager.getInstance().getColumnNamesByTableData(tableData)); // 获取当前所有用户组 - roleMap.putAll(WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization()); + roleMap.putAll(RemoteAuthorityRepository.getInstance().getAllRoles4Desensitization()); // 获取当前最新的所有规则 latestRules.putAll(DesensitizationRuleManager.getInstance().getAllRules()); return null; diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java b/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java index 1cc7dd0247..b447fec1a3 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java @@ -1 +1 @@ -package com.fr.design.roleAuthority; import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.log.FineLoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 *

* Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List rolelist = new ArrayList(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, FRContext.getOrganizationOperator().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } } \ No newline at end of file +package com.fr.design.roleAuthority; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.log.FineLoggerFactory; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 *

* Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List rolelist = new ArrayList(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, RemoteAuthorityRepository.getInstance().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java index d60e9a2c82..8a237d4d9c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java @@ -1,12 +1,11 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; -import com.fr.base.operator.org.OrganizationOperator; import com.fr.data.desensitize.rule.DesensitizationRuleManager; import com.fr.data.desensitize.rule.base.DesensitizationRule; import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.SwingWorker; +import javax.swing.*; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutionException; @@ -26,7 +25,7 @@ public class UpdateDataWorker extends SwingWorker, Void> { @Override protected Map doInBackground() { Map result = new HashMap<>(); - Map allRoles = WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization(); + Map allRoles = RemoteAuthorityRepository.getInstance().getAllRoles4Desensitization(); Map> allRules = DesensitizationRuleManager.getInstance().getAllRules(); result.put(ROLE_KEY, allRoles); From b44b2fbc38f7ff8baa8cffec2a3328be52ee2f64 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:36:58 +0800 Subject: [PATCH 21/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Templat?= =?UTF-8?q?eExportOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file/export/AbstractExportAction.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 7dc25799f3..f669403db5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -1,5 +1,7 @@ package com.fr.design.actions.file.export; +import com.fanruan.entity.template.TemplateExportBean; +import com.fanruan.repository.TemplateRepository; import com.fr.design.actions.JTemplateAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.dialog.FineJOptionPane; @@ -18,12 +20,8 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.third.jodd.io.FileNameUtil; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.exporter.TemplateExportOperator; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.event.ActionEvent; import java.io.OutputStream; import java.util.Map; @@ -215,9 +213,7 @@ public abstract class AbstractExportAction> extends JT path = path.substring(ProjectConstants.REPORTLETS_NAME.length()); } - byte[] contents = - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportKey(), exportType(), null, path, para); + byte[] contents = TemplateRepository.getInstance().export(new TemplateExportBean().setKey(exportKey()).setType(exportType()).setPath(path).setParas(para)); outputStream.write(contents); } From b12d108a7ce07a42afe28022cf7faa0d0bd91b22 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:42:54 +0800 Subject: [PATCH 22/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4DataBas?= =?UTF-8?q?eTypeOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 3b0f601926..48a09ba695 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -1,10 +1,8 @@ package com.fr.design.data.datapane.connect; -import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; -import com.fanruan.config.impl.data.ConnectionConfigWriterFactory; +import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; import com.fr.config.remote.RemoteConfigEvent; -import com.fine.theme.icon.LazyIcon; import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; @@ -34,14 +32,12 @@ import com.fr.stable.Nameable; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.database.DataBaseTypeOperator; -import com.fr.workspace.server.entity.connection.ConnectionBean; +import com.fr.workspace.server.repository.WorkplaceConstants; import com.fr.workspace.server.repository.connection.ConnectionRepository; import org.jetbrains.annotations.NotNull; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import java.awt.Window; +import javax.swing.*; +import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -86,7 +82,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh SwingWorker, Void> getSupportedTypesWorker = new SwingWorker, Void>() { @Override protected List doInBackground() { - return WorkContext.getCurrent().get(DataBaseTypeOperator.class).getSupportedDatabaseTypes(); + return WorkplaceConstants.getSupportedDatabaseTypes(); } @Override @@ -181,7 +177,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh JNDIDatabaseConnection.class, DatabaseConnectionPane.JNDI.class ); NameableCreator[] creators; - if (WorkContext.getCurrent().get(DataBaseTypeOperator.class).limitDatabaseType()) { + if (WorkplaceConstants.isLimitDatabaseType()) { // 不支持JNDI,屏蔽接口 creators = new NameableCreator[]{jdbc}; } else { From cfc652829739b17be13a72b38e77c71f99ffed86 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:51:35 +0800 Subject: [PATCH 23/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4TplOper?= =?UTF-8?q?ator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MultiTemplateTabPane.java | 26 +++++-------------- .../com/fr/design/mainframe/JTemplate.java | 15 ++++------- .../vcs/common/VcsCacheFileNodeFile.java | 9 +++---- .../com/fr/design/utils/TemplateUtils.java | 14 +++++----- 4 files changed, 22 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 8bedd19c96..0c8d62d587 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -1,6 +1,7 @@ package com.fr.design.file; +import com.fanruan.repository.TemplateRepository; import com.fine.swing.ui.layout.Layouts; import com.fine.swing.ui.layout.Row; import com.fine.theme.icon.LazyIcon; @@ -11,8 +12,8 @@ import com.fr.base.vcs.DesignerMode; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.file.LocateAction; -import com.fr.design.cache.DesignCacheManager; import com.fr.design.actions.template.NewWorkBookToolButtonAction; +import com.fr.design.cache.DesignCacheManager; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.MenuHandler; @@ -37,20 +38,9 @@ import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.collections.combination.Pair; import com.fr.third.javax.annotation.Nonnull; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; - -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JOptionPane; -import javax.swing.JSeparator; -import javax.swing.SwingUtilities; -import javax.swing.ToolTipManager; -import java.awt.AWTEvent; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Graphics; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -66,9 +56,7 @@ import static com.fine.theme.utils.FineUIScale.scale; import static com.fine.theme.utils.FineUIStyle.BUTTON_TAB_ACTION; import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.*; /** * 模版Tab组件 @@ -413,7 +401,7 @@ public class MultiTemplateTabPane extends Row { // 只有是环境内的文件,才执行释放锁 if (file != null && file.isEnvFile()) { // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + TemplateRepository.getInstance().close(file.getPath()); } } } 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 4fba7b581d..159bcbe282 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 @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fanruan.datasource.web.bean.ConnectionAuthorityConfigBean; import com.fanruan.product.ProductConstants; +import com.fanruan.repository.TemplateRepository; import com.fine.theme.icon.LazyIcon; import com.fr.base.Parameter; import com.fr.base.TRL; @@ -100,17 +101,11 @@ import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; import com.fr.widgettheme.designer.WidgetThemeDisplayAction; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; import com.fr.workspace.server.repository.connection.ConnectionRepository; -import com.fanruan.repository.TemplateRepository; -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.undo.UndoManager; -import java.awt.BorderLayout; +import java.awt.*; import java.io.ByteArrayOutputStream; import java.nio.file.Paths; import java.util.Arrays; @@ -936,12 +931,12 @@ public abstract class JTemplate> // 目标本地文件 !editingFILE.isEnvFile() || // 目标远程文件 - WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + TemplateRepository.getInstance().saveAs(editingFILE.getPath()); if (lockedTarget) { boolean saved = saveNewFile(editingFILE, oldName); // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); + TemplateRepository.getInstance().close(sourceFile.getPath()); } return saved; } else { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java index 16062c2936..e6bb0981ea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java @@ -1,14 +1,13 @@ package com.fr.design.mainframe.vcs.common; -import com.fr.io.FineEncryptUtils; +import com.fanruan.repository.TemplateRepository; import com.fr.base.io.XMLEncryptUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.io.FineEncryptUtils; import com.fr.stable.StableUtils; -import com.fr.workspace.WorkContext; import com.fr.workspace.resource.WorkResourceOutputStream; -import com.fr.workspace.server.lock.TplOperator; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import java.io.ByteArrayInputStream; @@ -43,9 +42,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { return null; } InputStream in = new ByteArrayInputStream( - WorkContext.getCurrent().get(TplOperator.class).readAndLockFile( - StableUtils.pathJoin(vcsCacheDir, envPath.substring(vcsCacheDir.length() + 1)) - ) + TemplateRepository.getInstance().open( StableUtils.pathJoin(vcsCacheDir, envPath.substring(vcsCacheDir.length() + 1))) ); return envPath.endsWith(".cpt") || envPath.endsWith(".frm") diff --git a/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java b/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java index ff0afe1e9a..af86bb9045 100644 --- a/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java @@ -1,5 +1,7 @@ package com.fr.design.utils; +import com.fanruan.product.ProductConstants; +import com.fanruan.repository.TemplateRepository; import com.fr.base.extension.FileExtension; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; @@ -15,13 +17,11 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreConstants; -import com.fanruan.product.ProductConstants; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; import org.jetbrains.annotations.Nullable; -import javax.swing.SwingWorker; +import javax.swing.*; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; @@ -141,7 +141,7 @@ public class TemplateUtils { OutputStream out = null; try { // 加锁 - boolean saveAsLock = WorkContext.getCurrent().get(TplOperator.class).saveAs(file.getPath()); + boolean saveAsLock = TemplateRepository.getInstance().saveAs(file.getPath()); if (!saveAsLock) { // 加锁失败时,直接返回 throw new RuntimeException("[RemoteDesign] back up template file failed"); @@ -155,7 +155,7 @@ public class TemplateUtils { } } finally { // 解锁 - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + TemplateRepository.getInstance().close(file.getPath()); } } return true; @@ -182,12 +182,12 @@ public class TemplateUtils { //判断一下要保存的副本文件是否已打开 int index = HistoryTemplateListCache.getInstance().contains(file); if (index != -1) { - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + TemplateRepository.getInstance().close(file.getPath()); needCloseTemplate.add(HistoryTemplateListCache.getInstance().getHistoryList().get(index)); } if (JTemplate.isValid(template)) { //给要关闭的模板解锁 - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + TemplateRepository.getInstance().close(template.getPath()); needCloseTemplate.add(template); } return needCloseTemplate; From 3a8e944ad60230ea56dcc5b49a57743f72930e1d Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:55:52 +0800 Subject: [PATCH 24/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Decisio?= =?UTF-8?q?nOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/remote/ui/CustomRoleManagerPane.java | 14 ++++---------- .../com/fr/design/remote/ui/UserManagerPane.java | 13 ++++--------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java index 3a0bc12672..a035153e5a 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java @@ -1,21 +1,15 @@ package com.fr.design.remote.ui; -import com.fine.theme.utils.FineUIUtils; -import com.fr.design.border.UITitledBorder; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.cell.AddedCustomRoleListCellRender; import com.fr.design.remote.ui.list.cell.AddingCustomRoleListCellRender; -import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.RemoteDesignMember; -import com.fr.workspace.server.authority.decision.DecisionOperator; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; +import javax.swing.*; import java.util.Collection; @@ -64,11 +58,11 @@ public class CustomRoleManagerPane extends AbstractManagerPane { @Override protected Collection getMembers(String userName, String keyWord){ - return WorkContext.getCurrent().get(DecisionOperator.class).getCustoms(userName, keyWord); + return RemoteAuthorityRepository.getInstance().getCustoms(userName, keyWord, 1, 50); } @Override protected Collection getMembers(String userName, String keyWord, int pageNum, int count){ - return WorkContext.getCurrent().get(DecisionOperator.class).getCustoms(userName, keyWord, pageNum, count); + return RemoteAuthorityRepository.getInstance().getCustoms(userName, keyWord, pageNum, count); } } diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java index 25ab410615..963ddddd18 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java @@ -1,20 +1,15 @@ package com.fr.design.remote.ui; -import com.fr.design.border.UITitledBorder; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.cell.AddedUserListCellRender; import com.fr.design.remote.ui.list.cell.AddingUserListCellRender; -import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.RemoteDesignMember; -import com.fr.workspace.server.authority.decision.DecisionOperator; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; +import javax.swing.*; import java.util.Collection; @@ -63,11 +58,11 @@ public class UserManagerPane extends AbstractManagerPane { @Override protected Collection getMembers(String userName, String keyWord){ - return WorkContext.getCurrent().get(DecisionOperator.class).getMembers(userName, keyWord); + return RemoteAuthorityRepository.getInstance().getMembers(userName, keyWord, 1, 50); } @Override protected Collection getMembers(String userName, String keyWord, int pageNum, int count){ - return WorkContext.getCurrent().get(DecisionOperator.class).getMembers(userName, keyWord, pageNum, count); + return RemoteAuthorityRepository.getInstance().getMembers(userName, keyWord, pageNum, count); } } \ No newline at end of file From ceb90ba2974177cd68fb6984dfb69a2a45bbbb5e Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:58:25 +0800 Subject: [PATCH 25/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Authori?= =?UTF-8?q?tyOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/remote/action/RemoteDesignAuthManagerAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java index 5b00029226..397308f037 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java @@ -12,7 +12,7 @@ import com.fr.report.DesignAuthority; import com.fr.report.constant.RoleType; import com.fr.stable.ArrayUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.authority.AuthorityOperator; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.awt.event.ActionEvent; import java.util.ArrayList; @@ -41,7 +41,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { if (!WorkContext.getCurrent().isLocal()) { try { // 远程设计获取全部设计成员的权限列表 - DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(); + DesignAuthority[] authorities = RemoteAuthorityRepository.getInstance().getAllAuthorities(); List userAuthorities = new ArrayList(); List customAuthorities = new ArrayList(); if (authorities != null) { @@ -75,7 +75,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { if (!WorkContext.getCurrent().isLocal()) { boolean success = false; try { - success = WorkContext.getCurrent().get(AuthorityOperator.class).updateAuthorities(authorities); + success = RemoteAuthorityRepository.getInstance().updateAuthorities(authorities); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From 4ab941d6669a7291ca21b03653f81b3d7093c373 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 8 Oct 2024 10:31:10 +0800 Subject: [PATCH 26/29] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4VcsOper?= =?UTF-8?q?ator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 3 +- .../com/fr/design/file/TemplateTreePane.java | 26 ++++------- .../mainframe/vcs/VcsOperatorWorker.java | 20 +++++---- .../mainframe/vcs/common/VcsHelper.java | 45 +++++++++---------- .../vcs/ui/EditFileVersionDialog.java | 19 ++++---- .../vcs/ui/FileVersionCellEditor.java | 5 ++- .../mainframe/vcs/ui/FileVersionDialog.java | 18 +++----- .../mainframe/vcs/ui/FileVersionRowPanel.java | 20 ++++----- .../mainframe/vcs/ui/FileVersionsPanel.java | 16 +++---- .../design/mainframe/vcs/ui/RecyclePane.java | 11 ++--- .../mainframe/vcs/ui/VcsCenterPane.java | 13 ++---- .../design/mainframe/vcs/ui/VcsNewPane.java | 21 +++------ 12 files changed, 90 insertions(+), 127 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 1babe368ec..b526b6ae2b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -64,7 +64,6 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsTaskBean; import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsConfig; -import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.git.config.GcConfig; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; @@ -1214,7 +1213,7 @@ public class PreferencePane extends BasicPane { @Override protected Boolean doInBackground() { - size = WorkContext.getCurrent().get(VcsOperator.class).immediatelyGc(); + size = VcsRepository.getInstance().immediatelyGc(); return true; } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 4eb45fface..262da62117 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -3,6 +3,7 @@ */ package com.fr.design.file; +import com.fanruan.repository.TemplateRepository; import com.fr.design.ExtraDesignClassManager; import com.fr.design.cache.DesignCacheManager; import com.fr.design.dialog.FineJOptionPane; @@ -11,10 +12,10 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.lock.LockInfoDialog; import com.fr.design.lock.LockInfoUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; -import com.fr.design.lock.LockInfoDialog; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateSearchRemindPane; @@ -27,25 +28,20 @@ import com.fr.form.fit.web.editpreview.FileLockStateObservable; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.workspace.base.UserInfo; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; +import com.fr.workspace.base.UserInfo; +import com.fr.workspace.server.repository.vcs.VcsRepository; +import org.jetbrains.annotations.Nullable; -import java.util.UUID; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import javax.swing.ToolTipManager; +import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.BorderLayout; -import java.awt.Desktop; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; @@ -60,14 +56,10 @@ import java.util.Objects; import java.util.Observable; import java.util.Observer; import java.util.Set; +import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; -import com.fanruan.repository.TemplateRepository; -import com.fr.workspace.server.vcs.VcsOperator; -import org.jetbrains.annotations.Nullable; - - import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; @@ -408,7 +400,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { if (nodeFILE.exists()) { if (!VcsHelper.getInstance().isLegacyMode()) { try { - WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath()); + VcsRepository.getInstance().recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java index 799abcf17c..99c1187bc3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java @@ -9,12 +9,12 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.v2.VcsTaskResult; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import java.util.ArrayList; +import javax.swing.*; import java.util.List; import java.util.concurrent.ExecutionException; @@ -108,7 +108,7 @@ public class VcsOperatorWorker { VcsProcessFailedWrapper wrapper = new VcsProcessFailedWrapper(); startProcess(vcsEntities, wrapper, (vcsEntity, operator) -> { String fileName = vcsEntity.getFilename(); - VcsTaskResult result = operator.restoreVersion(fileName); + VcsTaskResult result = VcsRepository.getInstance().restoreVersion(fileName); if (!result.isSuccess()) { wrapper.addFailedEntity(vcsEntity); } @@ -129,9 +129,9 @@ public class VcsOperatorWorker { String fileName = vcsEntity.getFilename(); VcsTaskResult result; if (all) { - result = operator.deleteVersionForRecycle(fileName); + result = VcsRepository.getInstance().deleteVersionForRecycle(fileName); } else { - result = operator.deleteVersion(fileName, vcsEntity.getVersion(), VcsEntity.CommitType.TYPE_DEFAULT); + result = VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, fileName, null, null, vcsEntity.getVersion(), 0, VcsEntity.CommitType.TYPE_DEFAULT))); } if (!result.isSuccess()) { wrapper.addFailedEntity(vcsEntity); @@ -148,7 +148,7 @@ public class VcsOperatorWorker { */ public void doDelete(VcsEntity entity, VcsTableOperatorListener listener) { String fileName = entity.getFilename(); - start4Single(entity, (vcsEntity, operator) -> operator.deleteVersionForRecycle(fileName), fileName + everyFailedStr, listener); + start4Single(entity, (vcsEntity, operator) -> VcsRepository.getInstance().deleteVersionForRecycle(fileName), fileName + everyFailedStr, listener); } /** @@ -160,7 +160,9 @@ public class VcsOperatorWorker { String fileName = entity.getFilename(); int version = entity.getVersion(); VcsEntity.CommitType commitType = entity.getCommitType(); - start4Single(entity, (vcsEntity, operator) -> operator.deleteVersion(fileName, version, commitType), fileName + everyFailedStr, listener); + start4Single(entity, (vcsEntity, operator) -> + VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, fileName, null, null, version, 0, commitType))), + fileName + everyFailedStr, listener); } @@ -171,7 +173,7 @@ public class VcsOperatorWorker { */ public void updateEntityAnnotation(VcsEntity entity, VcsTableOperatorListener listener) { start4Single(entity, (vcsEntity, operator) -> { - operator.updateVersion(entity); + VcsRepository.getInstance().updateVersion(new VcsBean(entity)); return new VcsTaskResult(true); }, everyFailedStr, listener); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 15787348fe..082faf09fd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -24,19 +24,19 @@ import com.fr.plugin.manage.PluginManager; import com.fr.report.entity.VcsEntity; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import com.fr.workspace.server.vcs.git.config.GcConfig; -import javax.swing.Icon; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.border.EmptyBorder; -import java.awt.Color; +import java.awt.*; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -84,7 +84,7 @@ public class VcsHelper implements JTemplateActionListener { // 开了设计器启动页面时一开始取不到VcsOperator,通过下面的切换环境事件再取,这边判断下 if (op != null) { try { - legacyMode = op.isLegacyMode(); + legacyMode = VcsRepository.getInstance().isLegacyMode(); root = WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot(); } catch (Exception e) { legacyMode = true; @@ -96,7 +96,7 @@ public class VcsHelper implements JTemplateActionListener { @Override protected void on(Event event) { try { - legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); + legacyMode = VcsRepository.getInstance().isLegacyMode(); FineLoggerFactory.getLogger().info("[VcsHelper] legacyMode:{}", legacyMode); } catch (Exception e) { //保险起见走老逻辑 @@ -217,22 +217,22 @@ public class VcsHelper implements JTemplateActionListener { public void run() { String fileName = getEditingFilename(); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); - VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); + VcsEntity entity = VcsRepository.getInstance().getVersion(new VcsQuery(fileName, 0, null, null)); boolean replace = needDeleteVersion(entity); int latestFileVersion = 0; if (entity != null) { latestFileVersion = entity.getVersion(); } if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + VcsRepository.getInstance().saveVersionFromCache(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace)); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - List updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); + List updatedList = VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY))); SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); } else { - operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + VcsRepository.getInstance().saveVersion(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace).setUseVersion(true)); } if (GcConfig.getInstance().isGcEnable()) { - operator.gc(); + VcsRepository.getInstance().gc(); } } @@ -252,21 +252,20 @@ public class VcsHelper implements JTemplateActionListener { moveVcs.execute(new Runnable() { @Override public void run() { - VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); String oldPath = oldName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); - List oldVcsEntities = operator.getVersions(oldPath); + List oldVcsEntities = VcsRepository.getInstance().getVersions(new VcsQuery(oldPath)); String replaceName = newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); for (VcsEntity oldVcsEntity : oldVcsEntities) { if (!VcsHelper.getInstance().isLegacyMode()) { - operator.renameVersion(oldVcsEntity, replaceName); + VcsRepository.getInstance().renameVersion(new VcsBean(oldVcsEntity, replaceName)); } else { - operator.saveVersion(oldVcsEntity.getUsername(), replaceName, oldVcsEntity.getCommitMsg(), oldVcsEntity.getVersion()); - operator.deleteVersion(oldPath, oldVcsEntity.getVersion()); + VcsRepository.getInstance().saveVersion(new VcsBean(new VcsEntity(oldVcsEntity.getUsername(), oldVcsEntity.getCommitMsg(), replaceName, null, null, oldVcsEntity.getVersion())).setUseVersion(true)); + VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, oldPath, null, null, oldVcsEntity.getVersion()))); } } FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, replaceName); if (GcConfig.getInstance().isGcEnable() && VcsHelper.getInstance().isLegacyMode()) { - operator.gc(); + VcsRepository.getInstance().gc(); } } }); @@ -314,7 +313,7 @@ public class VcsHelper implements JTemplateActionListener { public void fireAutoSaveVcs(final JTemplate jt) { String fileName = getEditingFilename(); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); - VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); + VcsEntity entity = VcsRepository.getInstance().getVersion(new VcsQuery(fileName, 0, null, null)); boolean replace = needDeleteVersion(entity); int latestFileVersion = 0; if (entity != null) { @@ -327,22 +326,22 @@ public class VcsHelper implements JTemplateActionListener { private void doSave(JTemplate jt, String fileName, int latestFileVersion, boolean replace, VcsOperator operator) { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + VcsRepository.getInstance().saveVersionFromCache(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace)); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - List updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); + List updatedList = VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY))); SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); } else { autoSave(jt, getCurrentUsername(), fileName, latestFileVersion + 1, replace, operator); } if (GcConfig.getInstance().isGcEnable()) { - operator.gc(); + VcsRepository.getInstance().gc(); } } private void autoSave(JTemplate jt, String currentUsername, String fileName, int nowVersion, boolean replace, VcsOperator operator) { try { if (JTemplate.isValid(jt) && !jt.isALLSaved()) { - operator.autoSave(currentUsername, fileName, StringUtils.EMPTY, nowVersion, jt.exportData(), replace); + VcsRepository.getInstance().autoSave(new VcsBean(new VcsEntity(currentUsername, StringUtils.EMPTY, fileName, null, null, nowVersion), replace, jt.exportData())); } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java index db92ab3eef..64568feac4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java @@ -18,14 +18,12 @@ import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; - -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Frame; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -118,11 +116,12 @@ public class EditFileVersionDialog extends UIDialog { */ public void doOK() { entity.setCommitMsg(msgTestArea.getText()); - WorkContext.getCurrent().get(VcsOperator.class).updateVersion(entity); + VcsRepository.getInstance().updateVersion(new VcsBean(entity)); setVisible(false); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); FileVersionTable table = FileVersionTable.getInstance(); - table.updateModel(table.getSelectedRow(), WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", StringUtils.EMPTY))); + + table.updateModel(table.getSelectedRow(), VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", StringUtils.EMPTY)))); } public UITextArea getMsgTestArea() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 8cff3ffbb1..7d161ead0d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -13,6 +13,7 @@ import com.fr.report.entity.VcsEntity; import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.AbstractCellEditor; @@ -43,10 +44,10 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe return editor; } else if (row == 0) { String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - fileOfVersion = vcsOperator.getFileOfCurrent(path.replaceFirst("/", "")); + fileOfVersion = VcsRepository.getInstance().getFileOfCurrent(path.replaceFirst("/", "")); } else { renderAndEditor.update((VcsEntity) value); - fileOfVersion = vcsOperator.getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); + fileOfVersion = VcsRepository.getInstance().getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion(), StringUtils.EMPTY); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index f023b6b92f..57b9d27d5f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.vcs.ui; -import com.fr.analysis.cloud.DateUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.editor.editor.DateEditor; import com.fr.design.gui.date.UIDatePicker; @@ -11,18 +10,11 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.AbstractAction; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.Window; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Calendar; @@ -70,7 +62,7 @@ public class FileVersionDialog extends UIDialog { Date editorDate = dateEditor.getValue(); Date start = editorDate == null ? new Date(0) : editorDate; Date end = editorDate == null ? getLastHour() : new Date(start.getTime() + DELAY); - List vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, start, end, textField.getText()); + List vcsEntities = VcsRepository.getInstance().getVersions(new VcsQuery(fileName, start, end, textField.getText())); FileVersionTable.getInstance().updateModel(1, vcsEntities); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index 2bd441c19e..b6dce1fd8f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -10,19 +10,16 @@ import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.Box; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; -import java.awt.BorderLayout; -import java.awt.Color; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; @@ -65,7 +62,7 @@ public class FileVersionRowPanel extends JPanel { if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { vcsEntity.setUsername(VcsHelper.getInstance().getCurrentUsername()); - WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); + VcsRepository.getInstance().rollbackTo(new VcsBean(vcsEntity)); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); } } @@ -79,14 +76,15 @@ public class FileVersionRowPanel extends JPanel { if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Delete-Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Remove"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { try { - WorkContext.getCurrent().get(VcsOperator.class).deleteVersion(vcsEntity.getFilename(), vcsEntity.getVersion()); + VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, vcsEntity.getFilename(), null, null, vcsEntity.getVersion()))); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } FileVersionTable table = (FileVersionTable) (FileVersionRowPanel.this.getParent()); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); try { - table.updateModel(table.getSelectedRow() - 1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + table.updateModel(table.getSelectedRow() - 1, + VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", "")))); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index 58393a3067..3207c1fbc2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -20,14 +20,11 @@ import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.SwingConstants; -import java.awt.BorderLayout; -import java.awt.Dimension; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -134,7 +131,8 @@ public class FileVersionsPanel extends BasicPane { } titleLabel.setText(filename); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + + FileVersionTable.getInstance().updateModel(1, VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", "")))); } public void showFileVersionsPane() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java index aca6ad2409..d89838e362 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java @@ -11,20 +11,17 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.TableEntity; import com.fr.design.mainframe.vcs.TableValueOperator; +import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsProcessFailedWrapper; import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.Icon; -import javax.swing.JOptionPane; -import javax.swing.JPanel; +import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -101,7 +98,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane @Override protected List getTableList() { - List entityList = WorkContext.getCurrent().get(VcsOperator.class).getRecycleEntities(); + List entityList = VcsRepository.getInstance().getRecycleEntities(); List tableEntities = new ArrayList<>(); for (VcsEntity entity : entityList) { tableEntities.add(new VcsTableEntity(entity)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index b95b35b7de..d9d67e4dff 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -9,7 +9,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsOperatorWorker; - import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper; @@ -17,15 +16,9 @@ import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.SwingWorker; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -211,7 +204,7 @@ public class VcsCenterPane extends VcsNewPane { @Override protected List getTableList() { - List entities = WorkContext.getCurrent().get(VcsOperator.class).getEveryVersion(); + List entities = VcsRepository.getInstance().getEveryVersion(); List tableEntities = new ArrayList<>(); for (VcsEntity entity : entities) { tableEntities.add(new VcsTableEntity(entity)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index f0615bfa49..5a413cf954 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.vcs.ui; import com.fine.theme.icon.LazyIcon; -import com.fr.base.svg.IconUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.MultiTemplateTabPane; @@ -18,8 +17,6 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; -import com.fr.file.filetree.FileNodes; -import com.fr.io.utils.ResourceIOUtils; import com.fr.report.InconsistentLockException; import com.fr.report.entity.VcsEntity; import com.fr.stable.StableUtils; @@ -27,16 +24,13 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.resource.WorkResource; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsFileUtils; -import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.v2.VcsTaskResult; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.SwingWorker; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -196,7 +190,7 @@ public class VcsNewPane extends RecyclePane { //step1.设置还原的用户名 entity.setUsername(VcsHelper.getInstance().getCurrentUsername()); //step2.rollback到指定版本 - WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(entity); + VcsRepository.getInstance().rollbackTo(new VcsBean(entity)); //最里面的文件系统的write会吞异常,这边就一直默认成功吧,日志里会体现失败的情况 return new VcsTaskResult(true); } @@ -294,8 +288,7 @@ public class VcsNewPane extends RecyclePane { @Override protected String doInBackground() throws Exception { //step1.将指定版本的历史文件读取出来,加上前缀放到cache中 - VcsOperator vcsOperator = WorkContext.getCurrent().get(VcsOperator.class); - String fileOfVersion = vcsOperator.getFileOfFileVersion( + String fileOfVersion = VcsRepository.getInstance().getFileOfFileVersion( entity.getFilename(), entity.getVersion(), Toolkit.i18nText("Fine-Design_Vcs_Prefix", entity.getVersion())); @@ -320,7 +313,7 @@ public class VcsNewPane extends RecyclePane { @Override protected List getTableList() { - List entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsFileUtils.dealWithFilePath(filePath)); + List entityList = VcsRepository.getInstance().getVersions(new VcsQuery(VcsFileUtils.dealWithFilePath(filePath))); List tableEntities = new ArrayList<>(); for (VcsEntity entity : entityList) { tableEntities.add(new VcsTableEntity(entity)); From 9430e29cb022ba55a1ce84267b52de0a9a9a3d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Tue, 8 Oct 2024 17:04:33 +0800 Subject: [PATCH 27/29] =?UTF-8?q?REPORT-136473=20&=20EPORT-136480=20fix:?= =?UTF-8?q?=20=E6=87=92=E5=8A=A0=E8=BD=BD=E5=AF=BC=E8=87=B4=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E8=BE=93=E5=85=A5=E6=A1=86=E4=BA=8B=E4=BB=B6=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/FormWidgetValuePane.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java index bb150383fc..31865224fc 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java @@ -5,7 +5,6 @@ import com.fr.design.editor.editor.DateEditor; import com.fr.design.editor.editor.DoubleEditor; import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.FormulaEditor; -import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.widget.editors.DataBindingEditor; @@ -19,6 +18,9 @@ import com.fr.form.ui.concept.data.ValueInitializer; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; @@ -34,20 +36,31 @@ import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; public class FormWidgetValuePane extends JPanel { private UIButtonGroup widgetValueHead; private Editor[] editor; - private ReactiveCardPane customPane; + private JPanel customPane; + private CardLayout cardLayout; public FormWidgetValuePane(Object o, boolean onlyServer) { DataControl widget = (DataControl) o; editor = createWidgetValueEditor(widget, onlyServer); this.setLayout(new BorderLayout()); - customPane = ReactiveCardPane.create(); + cardLayout = new CardLayout(); + customPane = new JPanel(cardLayout) { + @Override + public Dimension getPreferredSize() { + for (Component comp : getComponents()) { + if (comp.isVisible()) { + return comp.getPreferredSize(); + } + } + return new Dimension(0, 0); + } + }; final String[] tabTitles = new String[editor.length]; for (int i = 0; i < editor.length; i++) { Editor currentEditor = editor[i]; - customPane.addSupplier(editor[i].getName(), () -> currentEditor); + customPane.add(currentEditor, editor[i].getName()); tabTitles[i] = editor[i].getName(); } - customPane.select(editor[0].getName()).populate(); widgetValueHead = new UIButtonGroup(tabTitles); UILabel widgetValueLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); this.add(column(VERTICAL_GAP, @@ -69,7 +82,7 @@ public class FormWidgetValuePane extends JPanel { index = 0; widgetValueHead.setSelectedIndex(index); } - customPane.select(editor[index].getName()).populate(); + cardLayout.show(customPane, editor[index].getName()); } From eb911e021a6128d42d137d053631693412d43653 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 9 Oct 2024 16:00:16 +0800 Subject: [PATCH 28/29] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1,=E9=80=82?= =?UTF-8?q?=E9=85=8D=E9=A9=B1=E5=8A=A8=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/JDBCDefPane.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index ad159489bc..bbe0a19268 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.connect; +import com.fanruan.datasource.driver.bean.DriverLoaderBean; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIUtils; @@ -361,7 +362,7 @@ public class JDBCDefPane extends JPanel { private void initMap() { Map driverLoaders = null; try { - driverLoaders = ConnectionRepository.getInstance().getDriverLoaders(); + driverLoaders = toDriverLoaders(ConnectionRepository.getInstance().getDriverLoaders()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); driverLoaders = new HashMap<>(); @@ -370,6 +371,24 @@ public class JDBCDefPane extends JPanel { nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders); } + private Map toDriverLoaders(Map driverLoaders) { + Map map = new HashMap<>(); + for (Map.Entry entry : driverLoaders.entrySet()) { + map.put(entry.getKey(), createDriverLoader(entry.getValue())); + } + return map; + } + + private DriverLoader createDriverLoader(DriverLoaderBean value) { + DriverLoader driverLoader = new DriverLoader(); + driverLoader.setName(value.getName()); + driverLoader.setDriverClass(value.getDriverClass()); + driverLoader.setDriverJarFiles(value.getDriverJarFiles()); + driverLoader.setLoadingStrategy(value.getLoadingStrategy()); + driverLoader.setDriverList(value.getDriverList()); + return driverLoader; + } + private HashBiMap getDriverLoaderAndRepresent(Map driverLoaders) { HashBiMap driverHashBiMap = HashBiMap.create(); if (WorkContext.getCurrent().isWarDeploy()) { From d1fd96ae3332b0b7d164f559d376a895551d2f74 Mon Sep 17 00:00:00 2001 From: renekton Date: Thu, 10 Oct 2024 11:16:54 +0800 Subject: [PATCH 29/29] =?UTF-8?q?js=E9=AB=98=E7=BA=A7=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=BC=A9=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/javascript/JSContentWithDescriptionPane.java | 2 +- .../main/java/com/fr/design/javascript/JavaScriptImplPane.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index cdd7601c35..42a0fc584d 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -762,7 +762,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private JPanel createTipsPane() { JPanel tipsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); tipsPane.setLayout(new BorderLayout(4, 4)); - tipsPane.setBorder(BorderFactory.createEmptyBorder(30, 2, 0, 0)); + tipsPane.setBorder(new ScaledEmptyBorder(30, 2, 0, 0)); JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); searchPane.setLayout(new BorderLayout(4, 4)); keyWordTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Search_Interface")); diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java index bb1921689b..0baac74f0b 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java @@ -30,6 +30,7 @@ import java.util.List; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.theme.utils.FineUIScale.scale; public class JavaScriptImplPane extends AbstractHyperLinkPane { private static final int BOTTOM_BORDER = 12; @@ -73,7 +74,7 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane { cell(FineUIUtils.wrapComponentWithTitle(importedJsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"))).weight(0.5), cell(FineUIUtils.wrapComponentWithTitle(parameterPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))).weight(0.5) ).getComponent()); - topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, 150)); + topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, scale(150))); this.setLayout(new BorderLayout()); this.add(topPane, BorderLayout.NORTH);