Browse Source

Merge pull request #4192 in DESIGN/design from feature/10.0 to feature/x

* commit '27467731e25df875152ad3d5b064b0bd90e342bc':
  REPORT-51315 保存中的模板,标签的图标遗漏加载动效
  REPORT-51304 保存时gif背景为透明时 锯齿太严重 通过代码来绘制
  REPORT-51401 打开模板,设计器上日志顺序不对
  REPORT-51409 打开模板加载失败后,点击重试,文件目录上方的工具栏都变得可操作了
research/11.0
superman 4 years ago
parent
commit
90384ac8d1
  1. 9
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  2. 9
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  4. 3
      designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java
  5. 98
      designer-base/src/main/java/com/fr/design/mainframe/TransparentPane.java
  6. BIN
      designer-base/src/main/resources/com/fr/design/images/file/grey_saving_close.gif
  7. BIN
      designer-base/src/main/resources/com/fr/design/images/file/white_saving_close.gif
  8. 2
      designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java
  9. 2
      designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java
  10. 3
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

9
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.BorderFactory;
import javax.swing.ButtonModel; import javax.swing.ButtonModel;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuItem; 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 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_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 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 String ELLIPSIS = "...";
private static final int GAP = 5; private static final int GAP = 5;
private static final int SMALLGAP = 3; private static final int SMALLGAP = 3;
@ -386,8 +389,14 @@ public class MutilTempalteTabPane extends JComponent {
selectedIcon = CLOSE; selectedIcon = CLOSE;
} }
if (i == selectedIndex) { if (i == selectedIndex) {
if (template.isSaving()) {
selectedIcon = WHITE_SAVING_CLOSE_ICON;
}
startX[i - minPaintIndex] = paintSelectedTab(g2d, icon, templateStartX, name, selectedIcon); startX[i - minPaintIndex] = paintSelectedTab(g2d, icon, templateStartX, name, selectedIcon);
} else { } else {
if (template.isSaving()) {
selectedIcon = GREY_SAVING_CLOSE_ICON;
}
boolean isLeft = i < selectedIndex; boolean isLeft = i < selectedIndex;
startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i); startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i);
} }

9
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.requestFocus();
jt.revert(); jt.revert();
FineLoggerFactory.getLogger().info( // 打开为空占位模板时不输出
"\"" + jt.getEditingFILE().getName() + "\"" if (!jt.isOpening()) {
+ Toolkit.i18nText("Fine-Design_Basic_LOG_Has_Been_Openned") + "!"); FineLoggerFactory.getLogger().info(
"\"" + jt.getEditingFILE().getName() + "\""
+ Toolkit.i18nText("Fine-Design_Basic_LOG_Has_Been_Openned") + "!");
}
} }
/** /**

2
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() { public void showCover() {
transparentPane.start();
layeredPane.moveToFront(transparentPane); layeredPane.moveToFront(transparentPane);
DesignerContext.getDesignerFrame().refreshUIToolBar(); DesignerContext.getDesignerFrame().refreshUIToolBar();
} }
public void hideCover() { public void hideCover() {
transparentPane.stop();
layeredPane.moveToFront(component); layeredPane.moveToFront(component);
} }

3
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)) { if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
// 重试 // 重试
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
template.whenClose();
template = JTemplateFactory.createJTemplate(template.getEditingFILE()); template = JTemplateFactory.createJTemplate(template.getEditingFILE());
HistoryTemplateListCache.getInstance().replaceCurrentEditingTemplate(template);
DesignerContext.getDesignerFrame().addAndActivateJTemplate(template); DesignerContext.getDesignerFrame().addAndActivateJTemplate(template);
HistoryTemplateListCache.getInstance(). setCurrentEditingTemplate(template);
} }
} }
}); });

98
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.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Composite; import java.awt.Composite;
@ -11,23 +12,34 @@ import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.LayoutManager; 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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.Timer;
/** /**
* @author hades * @author hades
* @version 10.0 * @version 10.0
* Created by hades on 2021/4/12 * 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 UILabel label;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); 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() { public TransparentPane() {
@ -41,10 +53,7 @@ public class TransparentPane extends JComponent {
setLayout(getCoverLayout()); setLayout(getCoverLayout());
setBackground(null); setBackground(null);
setOpaque(false); setOpaque(false);
loadingLabel = new UILabel(LOADING_ICON);
label = new UILabel(Toolkit.i18nText("Fine-Design_Saving_Template_Tip")); label = new UILabel(Toolkit.i18nText("Fine-Design_Saving_Template_Tip"));
add(loadingLabel);
add(label); add(label);
} }
@ -69,16 +78,11 @@ public class TransparentPane extends JComponent {
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
int width = parent.getParent().getWidth(); int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight(); 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 labelWidth = label.getPreferredSize().width;
int labelHeight = label.getPreferredSize().height; int labelHeight = label.getPreferredSize().height;
int labelX = (width - labelWidth) / 2; int labelX = (width - labelWidth) / 2;
int labelY = (height - labelHeight) / 2 + loadingLabelHeight; int labelY = (int) ((height - labelHeight) * prec);
label.setBounds(labelX, labelY, labelWidth, labelHeight); label.setBounds(labelX, labelY, labelWidth, labelHeight);
loadingLabel.setBounds(buttonX, buttonY, loadingLabelWidth, loadingLabelHeight);
} }
@Override @Override
@ -90,13 +94,69 @@ public class TransparentPane extends JComponent {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g; int w = this.getWidth();
Composite oldComposite = g2d.getComposite(); int h = this.getHeight();
g2d.setComposite(composite);
g2d.setColor(Color.BLACK);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
super.paint(g); 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;
} }
} }

BIN
designer-base/src/main/resources/com/fr/design/images/file/grey_saving_close.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/file/white_saving_close.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

2
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.OpenResult;
import com.fr.design.worker.open.OpenWorker; import com.fr.design.worker.open.OpenWorker;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -42,6 +43,7 @@ abstract class AbstractWorkBookApp implements App<WorkBook> {
} }
}); });
worker.start(tplFile.getPath()); worker.start(tplFile.getPath());
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "...");
OpenResult<WorkBook, Parameter[]> result = worker.getResult(); OpenResult<WorkBook, Parameter[]> result = worker.getResult();
if (result != null) { if (result != null) {
return new JWorkBook(result.getBaseBook(), tplFile); return new JWorkBook(result.getBaseBook(), tplFile);

2
designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java

@ -58,8 +58,6 @@ class CptApp extends AbstractWorkBookApp {
} }
WorkBook tpl = new WorkBook(); 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(); TempNameStyle namestyle = TempNameStyle.getInstance();
namestyle.clear(); namestyle.clear();
try { try {

3
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); 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()); worker.start(tplFile.getPath());
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
if (result != null) { if (result != null) {
@ -83,8 +84,6 @@ class FormApp extends AbstractAppProvider {
// peter:打开新报表. // peter:打开新报表.
Form tpl = new Form(); Form tpl = new Form();
// richer:打开报表通知
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "...");
try { try {
tpl.readStream(file.asInputStream()); tpl.readStream(file.asInputStream());
} catch (DecryptTemplateException | ChartNotFoundException e) { } catch (DecryptTemplateException | ChartNotFoundException e) {

Loading…
Cancel
Save