From 7d717e353c6b73c05c24a0fc6a7d6069de4253b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Tue, 7 May 2024 15:59:49 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-111995=20=E3=80=90NewUI=E3=80=91?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E9=AA=8C=E6=94=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/light/ui/FineLightIconSet.java | 1 + .../refreshabletree/RefreshableJTree.java | 14 +++++----- .../fr/design/gui/style/TextFormatPane.java | 20 +++----------- .../DesignerFrameFileDealerPane.java | 2 -- .../design/mainframe/vcs/RecycleAction.java | 3 ++- .../resources/com/fine/theme/icon/recycle.svg | 8 ++++++ .../fr/design/expand/ExpandFatherPane.java | 26 ++++++------------- .../fr/design/widget/CellWidgetCardPane.java | 14 ++++------ .../com/fr/design/widget/WidgetEventPane.java | 7 +++++ 9 files changed, 41 insertions(+), 54 deletions(-) create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/recycle.svg diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java index 3bb48ea05b..e716e04466 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java @@ -39,6 +39,7 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("down_arrow_12", "com/fine/theme/icon/down_arrow.svg", true, 12), new SvgIconSource("up_arrow_12", "com/fine/theme/icon/up_arrow.svg", true, 12), new SvgIconSource("select", "com/fine/theme/icon/select.svg", true), + new SvgIconSource("recycle", "com/fine/theme/icon/recycle.svg", true), // 数据集相关Icon new SvgIconSource("database", "com/fine/theme/icon/dataset/database.svg", true), diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java index 6a8433225a..b649cf3c19 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java @@ -104,23 +104,21 @@ public abstract class RefreshableJTree extends CheckBoxTree { @Override protected Long doInBackground() throws Exception { long startTime = System.currentTimeMillis(); - - return System.currentTimeMillis() - startTime; - } - - @Override - protected void done() { ExpandMutableTreeNode[] nodes = RefreshableJTree.this.loadChildTreeNodes(treeNode); for (int i = 0; i < nodes.length; i++) { treeNode.add(nodes[i]); } - + DefaultTreeModel treeModel = (DefaultTreeModel) RefreshableJTree.this.getModel(); // 主要耗时是用在了treeUI的渲染上了,所以把这个放到工作线程里面 if (treeNode.getChildCount() >= 1 && ((ExpandMutableTreeNode) treeNode.getFirstChild()).getUserObject() == PENDING) { treeNode.remove(0); } - DefaultTreeModel treeModel = (DefaultTreeModel) RefreshableJTree.this.getModel(); treeModel.nodeStructureChanged(treeNode); + return System.currentTimeMillis() - startTime; + } + + @Override + protected void done() { RefreshableJTree.this.updateUI(); // 恢复Tree的可用性 RefreshableJTree.this.setEnabled(true); 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 c2fc1fdddc..d8263af1a6 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,5 +1,6 @@ package com.fr.design.gui.style; +import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; import com.fr.base.GraphHelper; @@ -116,23 +117,10 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName 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()) { - @Override - public void paint(Graphics g) { - super.paint(g); - int width = getWidth(); - Color original = g.getColor(); - g.setColor(getBackground()); - g.fillRect(LABEL_X, LABEL_Y, width - LABEL_DELTA_WIDTH, LABEL_HEIGHT); - g.setColor(labelColor); - FontMetrics cellFM = g.getFontMetrics(); - int textWidth = cellFM.stringWidth(getText()); - GraphHelper.drawString(g, getText(), (width - textWidth) / 2F, 26); - g.setColor(original); - } - }; + previewLabel = new UILabel(FormatField.getInstance().getFormatValue()); previewLabel.setHorizontalAlignment(UILabel.CENTER); previewLabel.setBorder(border); + FineUIStyle.setStyle(previewLabel, FineUIStyle.LABEL_TIP); } protected void initLayout() { @@ -286,7 +274,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName */ private void refreshPreviewLabel() { this.previewLabel.setText(FormatField.getInstance().getFormatValue()); - this.previewLabel.setForeground(UIManager.getColor("Label.foreground")); + FineUIStyle.setStyle(previewLabel, FineUIStyle.LABEL_TIP); try { isRightFormat = true; if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { 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 387dfece15..49fd533045 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 @@ -324,7 +324,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt */ private void addVcsAction(ToolBarDef toolbarDef) { if (VcsHelper.getInstance().needInit()) { - vcsAction = new VcsAction(); if (!isLegacyOnCluster()) { vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title")); @@ -334,7 +333,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt toolbarDef.addShortCut(vcsAction); //11.0.19及其之后加入回收站逻辑 if (VcsHelper.getInstance().checkV2FunctionSupport()) { - recycleAction = new RecycleAction(); toolbarDef.addShortCut(recycleAction); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/RecycleAction.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/RecycleAction.java index acd89f668d..b6da535892 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/RecycleAction.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/RecycleAction.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.vcs; +import com.fine.theme.icon.LazyIcon; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.i18n.Toolkit; @@ -18,7 +19,7 @@ import java.awt.event.ActionEvent; public class RecycleAction extends UpdateAction { public RecycleAction() { - this.setSmallIcon("/com/fr/design/standard/vcslist/vcs_recycle", false); + this.setSmallIcon(new LazyIcon("recycle")); this.setName(Toolkit.i18nText("Fine-Design_Vcs_Recycle")); } diff --git a/designer-base/src/main/resources/com/fine/theme/icon/recycle.svg b/designer-base/src/main/resources/com/fine/theme/icon/recycle.svg new file mode 100644 index 0000000000..ab3b97e703 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/recycle.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java b/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java index 5a32b0e61d..ac226425b0 100644 --- a/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java +++ b/designer-realize/src/main/java/com/fr/design/expand/ExpandFatherPane.java @@ -1,12 +1,10 @@ package com.fr.design.expand; -import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fr.design.constants.LayoutConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.gui.columnrow.ColumnRowPane; -import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.ElementCasePane; @@ -18,12 +16,13 @@ import com.fr.grid.selection.Selection; import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.stable.ColumnRow; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver { @@ -35,7 +34,6 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser private String expandFatherName = ""; private GlobalNameListener globalNameListener = null; private boolean isAlreadyAddListener = false; - private ReactiveCardPane cardPane; public ExpandFatherPane() { this.setLayout(new BorderLayout()); @@ -55,20 +53,12 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser JPanel cc = new JPanel(new BorderLayout(LayoutConstants.HGAP_SMALL, 0)); cc.add(customParentColumnRowPane, BorderLayout.CENTER); cc.add(imageButton, BorderLayout.EAST); - cardPane = ReactiveCardPane.create() - .addSupplier("content", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - cell(comboBox), - cell(cc)).getComponent()) - .addSupplier("none", () -> Layouts.cell(comboBox).getComponent()); - cardPane.select("none").populate(); - this.add(cardPane); + this.add(column(LayoutConstants.VERTICAL_GAP, + cell(comboBox), + cell(cc) + ).getComponent()); comboBox.addItemListener(e -> { - if (comboBox.getSelectedIndex() == 2) { - cardPane.select("content").populate(); - } else { - cardPane.select("none").populate(); - - } + cc.setVisible(comboBox.getSelectedIndex() == 2); if (globalNameListener != null && shouldResponseNameListener()) { globalNameListener.setGlobalName(expandFatherName); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java index 3a88feb36d..71dbd52603 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java @@ -23,7 +23,6 @@ import java.util.ArrayList; 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; /* * carl :单独弄出来 @@ -76,14 +75,11 @@ public class CellWidgetCardPane extends BasicPane { } }; - this.add(column( - row( - fix(10), - cell(tabsHeaderIconPane).weight(1), - fix(10) - ), - cell(center).with(it -> it.setBorder(new ScaledEmptyBorder(0, 10, 0, 10))) - ).getComponent()); + JPanel wrapperPane = new JPanel(new BorderLayout()); + wrapperPane.add(tabsHeaderIconPane, BorderLayout.NORTH); + wrapperPane.add(center, BorderLayout.CENTER); + wrapperPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); + this.add(wrapperPane, BorderLayout.CENTER); // 属性 attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java index 41e5a99011..47db0235f1 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java @@ -1,6 +1,7 @@ package com.fr.design.widget; +import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -24,6 +25,7 @@ import com.fr.stable.AssistUtils; import com.fr.stable.Nameable; import com.fr.write.JavaScriptResourceInfo; +import java.awt.Dimension; import java.lang.reflect.Constructor; public class WidgetEventPane extends UIListGroupControlPane { @@ -203,6 +205,11 @@ public class WidgetEventPane extends UIListGroupControlPane { } } + @Override + public Dimension getPreferredSize() { + return FineUIScale.scale(new Dimension(200, 950)); + } + protected String getWrapperLabelText() { return Toolkit.i18nText("Fine-Design_Report_Event"); }