diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 0e81485849..d2d77117fd 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -26,6 +26,7 @@ import com.fr.third.javax.annotation.Nonnull; import javax.swing.BorderFactory; import javax.swing.ButtonModel; import javax.swing.Icon; +import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuItem; @@ -69,6 +70,8 @@ public class MutilTempalteTabPane extends JComponent { private static Icon CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); private static Icon MOUSE_OVER_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png"); private static Icon MOUSE_PRESS_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png"); + private static final Icon WHITE_SAVING_CLOSE_ICON = new ImageIcon(MutilTempalteTabPane.class.getResource("/com/fr/design/images/file/white_saving_close.gif")); + private static final Icon GREY_SAVING_CLOSE_ICON = new ImageIcon(MutilTempalteTabPane.class.getResource("/com/fr/design/images/file/grey_saving_close.gif")); private static final String ELLIPSIS = "..."; private static final int GAP = 5; private static final int SMALLGAP = 3; @@ -386,8 +389,14 @@ public class MutilTempalteTabPane extends JComponent { selectedIcon = CLOSE; } if (i == selectedIndex) { + if (template.isSaving()) { + selectedIcon = WHITE_SAVING_CLOSE_ICON; + } startX[i - minPaintIndex] = paintSelectedTab(g2d, icon, templateStartX, name, selectedIcon); } else { + if (template.isSaving()) { + selectedIcon = GREY_SAVING_CLOSE_ICON; + } boolean isLeft = i < selectedIndex; startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i); } 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 ad4726d664..fe25890282 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 @@ -181,9 +181,12 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt jt.requestFocus(); jt.revert(); - FineLoggerFactory.getLogger().info( - "\"" + jt.getEditingFILE().getName() + "\"" - + Toolkit.i18nText("Fine-Design_Basic_LOG_Has_Been_Openned") + "!"); + // 打开为空占位模板时不输出 + if (!jt.isOpening()) { + FineLoggerFactory.getLogger().info( + "\"" + jt.getEditingFILE().getName() + "\"" + + Toolkit.i18nText("Fine-Design_Basic_LOG_Has_Been_Openned") + "!"); + } } /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index a2cc6f8065..22a10d3ba0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -105,11 +105,13 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener } public void showCover() { + transparentPane.start(); layeredPane.moveToFront(transparentPane); DesignerContext.getDesignerFrame().refreshUIToolBar(); } public void hideCover() { + transparentPane.stop(); layeredPane.moveToFront(component); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java b/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java index 101585abb3..132569c236 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java @@ -74,9 +74,10 @@ public class OpenFailedPane extends JPanel { if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { // 重试 JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + template.whenClose(); template = JTemplateFactory.createJTemplate(template.getEditingFILE()); + HistoryTemplateListCache.getInstance().replaceCurrentEditingTemplate(template); DesignerContext.getDesignerFrame().addAndActivateJTemplate(template); - HistoryTemplateListCache.getInstance(). setCurrentEditingTemplate(template); } } }); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TransparentPane.java b/designer-base/src/main/java/com/fr/design/mainframe/TransparentPane.java index 100ab04f63..8861a75919 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TransparentPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TransparentPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import java.awt.AlphaComposite; +import java.awt.BasicStroke; import java.awt.Color; import java.awt.Component; import java.awt.Composite; @@ -11,23 +12,34 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.LayoutManager; +import java.awt.RenderingHints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.ImageIcon; import javax.swing.JComponent; +import javax.swing.Timer; /** * @author hades * @version 10.0 * Created by hades on 2021/4/12 */ -public class TransparentPane extends JComponent { +public class TransparentPane extends JComponent implements ActionListener { - private static final ImageIcon LOADING_ICON = new ImageIcon(TransparentPane.class.getResource("/com/fr/web/images/loading-local.gif")); - - private UILabel loadingLabel; private UILabel label; private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); + private volatile boolean mIsRunning; + private volatile boolean mIsFadingOut; + private Timer mTimer; + private int mAngle; + private int mFadeCount; + private int mFadeLimit = 15; + private int lines = 12; + private int maxAngle = 360; + private int angleAdd = 30; + private double prec = 0.56; public TransparentPane() { @@ -41,10 +53,7 @@ public class TransparentPane extends JComponent { setLayout(getCoverLayout()); setBackground(null); setOpaque(false); - - loadingLabel = new UILabel(LOADING_ICON); label = new UILabel(Toolkit.i18nText("Fine-Design_Saving_Template_Tip")); - add(loadingLabel); add(label); } @@ -69,16 +78,11 @@ public class TransparentPane extends JComponent { public void layoutContainer(Container parent) { int width = parent.getParent().getWidth(); int height = parent.getParent().getHeight(); - int loadingLabelWidth = loadingLabel.getPreferredSize().width; - int loadingLabelHeight = loadingLabel.getPreferredSize().height; - int buttonX = (width - loadingLabelWidth) / 2; - int buttonY = (height - loadingLabelHeight) / 2; int labelWidth = label.getPreferredSize().width; int labelHeight = label.getPreferredSize().height; int labelX = (width - labelWidth) / 2; - int labelY = (height - labelHeight) / 2 + loadingLabelHeight; + int labelY = (int) ((height - labelHeight) * prec); label.setBounds(labelX, labelY, labelWidth, labelHeight); - loadingLabel.setBounds(buttonX, buttonY, loadingLabelWidth, loadingLabelHeight); } @Override @@ -90,13 +94,69 @@ public class TransparentPane extends JComponent { @Override public void paint(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - g2d.setComposite(composite); - g2d.setColor(Color.BLACK); - g2d.fillRect(0, 0, getWidth(), getHeight()); - g2d.setComposite(oldComposite); + int w = this.getWidth(); + int h = this.getHeight(); super.paint(g); + if (!mIsRunning) { + return; + } + Graphics2D g2 = (Graphics2D) g.create(); + float fade = (float) mFadeCount / (float) mFadeLimit; + Composite urComposite = g2.getComposite(); + g2.setComposite(composite); + g2.fillRect(0, 0, w, h); + g2.setComposite(urComposite); + int s = Math.min(w, h) / 50; + int cx = w / 2; + int cy = h / 2; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setStroke(new BasicStroke(s / 4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + g2.setPaint(Color.BLACK); + g2.rotate(Math.PI * mAngle / 180, cx, cy); + for (int i = 0; i < lines; i++) { + float scale = (11.0f - (float) i) / 11.0f; + g2.drawLine(cx + s, cy, cx + s * 2, cy); + g2.rotate(-Math.PI / 6, cx, cy); + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, scale * fade)); + } + g2.dispose(); + } + + @Override + public void actionPerformed(ActionEvent e) { + if (mIsRunning) { + repaint(); + mAngle += angleAdd; + if (mAngle >= maxAngle) { + mAngle = 0; + } + if (mIsFadingOut) { + if (--mFadeCount == 0) { + mIsRunning = false; + mTimer.stop(); + } + } else if (mFadeCount < mFadeLimit) { + mFadeCount++; + } + } + } + + public void start() { + if (mIsRunning) { + return; + } + mIsRunning = true; + mIsFadingOut = false; + mFadeCount = 0; + int fps = 24; + int tick = 1000 / fps; + mTimer = new Timer(tick, this); + mTimer.start(); + } + + public void stop() { + mIsRunning = false; + mIsFadingOut = true; } } diff --git a/designer-base/src/main/resources/com/fr/design/images/file/grey_saving_close.gif b/designer-base/src/main/resources/com/fr/design/images/file/grey_saving_close.gif new file mode 100644 index 0000000000..a3c061b0f1 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/file/grey_saving_close.gif differ diff --git a/designer-base/src/main/resources/com/fr/design/images/file/white_saving_close.gif b/designer-base/src/main/resources/com/fr/design/images/file/white_saving_close.gif new file mode 100644 index 0000000000..2c287adbb5 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/file/white_saving_close.gif differ diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java index 824fbf77d3..3fd12d81a3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java @@ -7,6 +7,7 @@ import com.fr.design.mainframe.JWorkBook; import com.fr.design.worker.open.OpenResult; import com.fr.design.worker.open.OpenWorker; import com.fr.file.FILE; +import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; import com.fr.report.worksheet.WorkSheet; import java.util.concurrent.Callable; @@ -42,6 +43,7 @@ abstract class AbstractWorkBookApp implements App { } }); worker.start(tplFile.getPath()); + FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); OpenResult result = worker.getResult(); if (result != null) { return new JWorkBook(result.getBaseBook(), tplFile); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java index 5733151c16..4e9980a499 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java @@ -58,8 +58,6 @@ class CptApp extends AbstractWorkBookApp { } WorkBook tpl = new WorkBook(); - // richer:打开报表通知 - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "..."); TempNameStyle namestyle = TempNameStyle.getInstance(); namestyle.clear(); try { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index 616d4be079..05454fcbe8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -61,6 +61,7 @@ class FormApp extends AbstractAppProvider { new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class); } }); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); worker.start(tplFile.getPath()); OpenResult result = worker.getResult(); if (result != null) { @@ -83,8 +84,6 @@ class FormApp extends AbstractAppProvider { // peter:打开新报表. Form tpl = new Form(); - // richer:打开报表通知 - FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "..."); try { tpl.readStream(file.asInputStream()); } catch (DecryptTemplateException | ChartNotFoundException e) {