* commit 'd62196745d51eae21f91564fcd3bf9da6fb0a504': (68 commits) REPORT-52212 切换远程出现白色弹窗 漏改调整 REPORT-52462 保存模板时,将设计器最小化到后台,模板保存失败的弹窗到了屏幕左上角 REPORT-52411 && REPORT-52222 设计器吃资源cpu和gpu REPORT-52418 国际化适配 REPORT-52406 导出-字体检测-权限编辑时检测按钮需要灰化 REPORT-52212 去掉工作目录切换成功提示 REPORT-52212 【10.0.16冒烟】切换远程出现白色弹窗 update 遗漏的 REPORT-52212 【10.0.16冒烟】切换远程出现白色弹窗 REPORT-52103 打开聚合报表的情况下 插件-性能优化插件-启用太慢 update REPORT-52103 打开聚合报表的情况下 插件-性能优化插件-启用太慢 REPORT-52085 装有老版本的新自适应插件 frm无法打开 REPORT-51442 菜单栏和数据集面板灰化问题 CHART-19174 设计器自定义wms带token无效问题 REPORT-51305 打开/保存模板时切换时 右侧面板可用问题 + 第一次打开时加载动画问题 REPORT-51315 保存中的模板,标签的图标遗漏加载动效 REPORT-51304 保存时gif背景为透明时 锯齿太严重 通过代码来绘制 REPORT-51401 打开模板,设计器上日志顺序不对 REPORT-51409 打开模板加载失败后,点击重试,文件目录上方的工具栏都变得可操作了 CHART-19104 鼠标的click事件不能稳定触发,改为change事件 REPORT-51281 & REPORT-51378 & REPORT-51490 导出-字体检测-模板保存相关问题 ...persist/10.0 10.0.16.2021.05.19
@ -0,0 +1,26 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UIForbiddenButton; |
||||
import javax.swing.AbstractButton; |
||||
import javax.swing.JComponent; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/12 |
||||
*/ |
||||
public abstract class ForbiddenUpdateAction extends UpdateAction { |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIForbiddenButton.class.getName()); |
||||
if (!(object instanceof AbstractButton)) { |
||||
UIButton button = null; |
||||
button = new UIForbiddenButton(); |
||||
object = initButton(button, UIForbiddenButton.class.getName()); |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
} |
@ -1 +1,44 @@
|
||||
package com.fr.design.actions.file;
import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.menu.KeySetUtils;
import java.awt.event.ActionEvent;
/**
* Author : daisy
* Date: 13-8-16
* Time: 下午3:23
*/
public class CloseCurrentTemplateAction extends UpdateAction {
public CloseCurrentTemplateAction() {
this.setMenuKeySet(KeySetUtils.CLOSE_CURRENT_TEMPLATE);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setAccelerator(getMenuKeySet().getKeyStroke());
}
/**
* 动作
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
} |
||||
package com.fr.design.actions.file; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.file.HistoryTemplateListPane; |
||||
import com.fr.design.file.MutilTempalteTabPane; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Author : daisy |
||||
* Date: 13-8-16 |
||||
* Time: 下午3:23 |
||||
*/ |
||||
public class CloseCurrentTemplateAction extends UpdateAction { |
||||
|
||||
public CloseCurrentTemplateAction() { |
||||
this.setMenuKeySet(KeySetUtils.CLOSE_CURRENT_TEMPLATE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setAccelerator(getMenuKeySet().getKeyStroke()); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); |
||||
MutilTempalteTabPane.getInstance().closeFormat(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
||||
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (template != null) { |
||||
this.setEnabled(!template.isSaving()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,118 @@
|
||||
package com.fr.design.data.datapane.connect; |
||||
|
||||
import com.fr.data.impl.JDBCDatabaseConnection; |
||||
import com.fr.data.pool.DBCPConnectionPoolAttr; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.editor.editor.IntegerEditor; |
||||
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.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
|
||||
public class DBCPAttrPane extends BasicPane { |
||||
public static final int TIME_MULTIPLE = 1000; |
||||
// carl:DBCP的一些属性
|
||||
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); |
||||
private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor(); |
||||
private IntegerEditor DBCP_MAX_IDLE = new IntegerEditor(); |
||||
private IntegerEditor DBCP_MIN_IDLE = new IntegerEditor(); |
||||
private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor(); |
||||
private UITextField DBCP_VALIDATION_QUERY = new UITextField(); |
||||
|
||||
private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); |
||||
private UIComboBox DBCP_TESTONRETURN = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); |
||||
private UIComboBox DBCP_TESTWHILEIDLE = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); |
||||
|
||||
private IntegerEditor DBCP_TIMEBETWEENEVICTIONRUNSMILLS = new IntegerEditor(); |
||||
private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); |
||||
private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); |
||||
|
||||
public DBCPAttrPane() { |
||||
JPanel defaultPane = this; |
||||
|
||||
// JPanel northFlowPane
|
||||
JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||
defaultPane.add(northFlowPane, BorderLayout.NORTH); |
||||
|
||||
DBCP_VALIDATION_QUERY.setColumns(15); |
||||
// ContextPane
|
||||
|
||||
double f = TableLayout.FILL; |
||||
// double p = TableLayout.PREFERRED;
|
||||
double[] rowSize = {f, f, f, f, f, f, f, f, f, f, f, f}; |
||||
double[] columnSize = {f, f}; |
||||
Component[][] comps = { |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT), |
||||
DBCP_TIMEBETWEENEVICTIONRUNSMILLS}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT), |
||||
DBCP_MINEVICTABLEIDLETIMEMILLIS}}; |
||||
|
||||
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); |
||||
contextPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIConstants.LINE_COLOR)); |
||||
northFlowPane.add(contextPane); |
||||
} |
||||
|
||||
public void populate(JDBCDatabaseConnection jdbcDatabase) { |
||||
DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); |
||||
if (dbcpAttr == null) { |
||||
dbcpAttr = new DBCPConnectionPoolAttr(); |
||||
jdbcDatabase.setDbcpAttr(dbcpAttr); |
||||
} |
||||
this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize()); |
||||
this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive()); |
||||
this.DBCP_MAX_IDLE.setValue(dbcpAttr.getMaxIdle()); |
||||
this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait()); |
||||
this.DBCP_MIN_IDLE.setValue(dbcpAttr.getMinIdle()); |
||||
this.DBCP_VALIDATION_QUERY.setText(dbcpAttr.getValidationQuery()); |
||||
this.DBCP_TESTONBORROW.setSelectedIndex(dbcpAttr.isTestOnBorrow() ? 1 : 0); |
||||
this.DBCP_TESTONRETURN.setSelectedIndex(dbcpAttr.isTestOnReturn() ? 1 : 0); |
||||
this.DBCP_TESTWHILEIDLE.setSelectedIndex(dbcpAttr.isTestWhileIdle() ? 1 : 0); |
||||
this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE); |
||||
this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun()); |
||||
this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); |
||||
} |
||||
|
||||
public void update(JDBCDatabaseConnection jdbcDatabase) { |
||||
DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); |
||||
if (dbcpAttr == null) { |
||||
dbcpAttr = new DBCPConnectionPoolAttr(); |
||||
jdbcDatabase.setDbcpAttr(dbcpAttr); |
||||
} |
||||
dbcpAttr.setInitialSize(this.DBCP_INITIAL_SIZE.getValue().intValue()); |
||||
dbcpAttr.setMaxActive(this.DBCP_MAX_ACTIVE.getValue().intValue()); |
||||
dbcpAttr.setMaxIdle(this.DBCP_MAX_IDLE.getValue().intValue()); |
||||
dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue()); |
||||
dbcpAttr.setMinIdle(this.DBCP_MIN_IDLE.getValue().intValue()); |
||||
dbcpAttr.setValidationQuery(this.DBCP_VALIDATION_QUERY.getText()); |
||||
dbcpAttr.setTestOnBorrow(this.DBCP_TESTONBORROW.getSelectedIndex() == 0 ? false : true); |
||||
dbcpAttr.setTestOnReturn(this.DBCP_TESTONRETURN.getSelectedIndex() == 0 ? false : true); |
||||
dbcpAttr.setTestWhileIdle(this.DBCP_TESTWHILEIDLE.getSelectedIndex() == 0 ? false : true); |
||||
dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE); |
||||
dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue()); |
||||
dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue()); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"); |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.design.env; |
||||
|
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.Workspace; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/11 |
||||
*/ |
||||
public class DesignerWorkspaceLoader { |
||||
|
||||
public static void init() { |
||||
Workspace workspace = WorkContext.getCurrent(); |
||||
if (workspace.isLocal()) { |
||||
return; |
||||
} |
||||
workspace.isWarDeploy(); |
||||
workspace.isCluster(); |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.env; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Dimension; |
||||
import javax.swing.ImageIcon; |
||||
import javax.swing.JDialog; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/10 |
||||
*/ |
||||
public class WorkspaceChangeLoadingDialog extends JDialog { |
||||
|
||||
private static final ImageIcon LOADING_ICON = new ImageIcon(WorkspaceChangeLoadingDialog.class.getResource("/com/fr/web/images/loading-local.gif")); |
||||
|
||||
private static WorkspaceChangeLoadingDialog dialog; |
||||
|
||||
public WorkspaceChangeLoadingDialog() { |
||||
super(DesignerContext.getDesignerFrame()); |
||||
setLayout(new BorderLayout()); |
||||
this.getContentPane().setBackground(Color.WHITE); |
||||
this.setResizable(false); |
||||
this.setUndecorated(true); |
||||
this.setAlwaysOnTop(true); |
||||
this.setModal(false); |
||||
this.setSize(new Dimension(400, 100)); |
||||
this.add(new UILabel(LOADING_ICON, UILabel.CENTER), BorderLayout.NORTH); |
||||
this.add(new UILabel(Toolkit.i18nText("Fine-Design_Change_Workspace_Tip"), UILabel.CENTER), BorderLayout.CENTER); |
||||
GUICoreUtils.centerWindow(this); |
||||
} |
||||
|
||||
|
||||
public static void showDialog() { |
||||
dialog = new WorkspaceChangeLoadingDialog(); |
||||
dialog.setVisible(true); |
||||
} |
||||
|
||||
public static void hideDialog() { |
||||
dialog.dispose(); |
||||
} |
||||
} |
@ -0,0 +1,64 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import com.fr.base.CellBorderStyle; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import javax.swing.Action; |
||||
import javax.swing.Icon; |
||||
import javax.swing.plaf.ButtonUI; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/9 |
||||
*/ |
||||
public class UIForbiddenButton extends UIButton { |
||||
|
||||
public UIForbiddenButton() { |
||||
super(); |
||||
} |
||||
|
||||
public UIForbiddenButton(String string) { |
||||
super(string); |
||||
} |
||||
|
||||
public UIForbiddenButton(Icon icon) { |
||||
super(icon); |
||||
} |
||||
|
||||
public UIForbiddenButton(Action action) { |
||||
super(action); |
||||
} |
||||
|
||||
public UIForbiddenButton(String text, Icon icon) { |
||||
super(text, icon); |
||||
} |
||||
|
||||
public UIForbiddenButton(Icon normal, Icon rollOver, Icon pressed) { |
||||
super(normal, rollOver, pressed); |
||||
} |
||||
|
||||
public UIForbiddenButton(String resource, boolean needSetDisabledIcon) { |
||||
super(resource, needSetDisabledIcon); |
||||
} |
||||
|
||||
@Override |
||||
public CellBorderStyle getBorderStyle() { |
||||
return super.getBorderStyle(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isEnabled() { |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
boolean enabled = true; |
||||
if (template != null) { |
||||
enabled = super.isEnabled() && template.checkEnable(); |
||||
} |
||||
return enabled; |
||||
} |
||||
|
||||
@Override |
||||
public ButtonUI getUI() { |
||||
return new UIForbiddenButtonUI(); |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import java.awt.Graphics; |
||||
import javax.swing.JComponent; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/11 |
||||
*/ |
||||
public class UIForbiddenButtonUI extends UIButtonUI { |
||||
|
||||
@Override |
||||
public void paint(Graphics g, JComponent c) { |
||||
super.paint(g, c); |
||||
c.setEnabled(c.isEnabled()); |
||||
} |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import javax.swing.Action; |
||||
import javax.swing.Icon; |
||||
import javax.swing.plaf.ButtonUI; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/10 |
||||
*/ |
||||
public class UISaveForbiddenButton extends UIButton { |
||||
public UISaveForbiddenButton() { |
||||
} |
||||
|
||||
public UISaveForbiddenButton(String string) { |
||||
super(string); |
||||
} |
||||
|
||||
public UISaveForbiddenButton(Icon icon) { |
||||
super(icon); |
||||
} |
||||
|
||||
public UISaveForbiddenButton(Action action) { |
||||
super(action); |
||||
} |
||||
|
||||
public UISaveForbiddenButton(String text, Icon icon) { |
||||
super(text, icon); |
||||
} |
||||
|
||||
public UISaveForbiddenButton(Icon normal, Icon rollOver, Icon pressed) { |
||||
super(normal, rollOver, pressed); |
||||
} |
||||
|
||||
public UISaveForbiddenButton(String resource, boolean needSetDisabledIcon) { |
||||
super(resource, needSetDisabledIcon); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isEnabled() { |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
boolean enabled = true; |
||||
if (template != null) { |
||||
enabled = !template.isSaving(); |
||||
} |
||||
return enabled; |
||||
} |
||||
|
||||
@Override |
||||
public ButtonUI getUI() { |
||||
return new UISaveForbiddenButtonUI(); |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import java.awt.Graphics; |
||||
import javax.swing.JComponent; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/14 |
||||
*/ |
||||
public class UISaveForbiddenButtonUI extends UIButtonUI { |
||||
|
||||
@Override |
||||
public void paint(Graphics g, JComponent c) { |
||||
super.paint(g, c); |
||||
c.setEnabled(c.isEnabled()); |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.worker.save.CallbackSaveWorker; |
||||
|
||||
/** |
||||
* 模板保存接口 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/9 |
||||
*/ |
||||
public interface JTemplateSave { |
||||
|
||||
/** |
||||
* 保存后需要根据是否成功做外部回调,可选保存位置 |
||||
* |
||||
* @return |
||||
*/ |
||||
CallbackSaveWorker save(); |
||||
|
||||
|
||||
/** |
||||
* 另存为后需要根据是否成功做外部回调,可选保存位置 |
||||
* |
||||
* @return |
||||
*/ |
||||
CallbackSaveWorker saveAs(); |
||||
|
||||
|
||||
/** |
||||
* 保存到当前工作目录(reportlets)后需要根据是否成功做外部回调 |
||||
* |
||||
* |
||||
* @return |
||||
*/ |
||||
CallbackSaveWorker save2Env(); |
||||
|
||||
|
||||
/** |
||||
* 另存为到当前工作目录(reportlets)后需要根据是否成功做外部回调 |
||||
* |
||||
* @return |
||||
*/ |
||||
CallbackSaveWorker saveAs2Env(); |
||||
|
||||
/**D |
||||
* 直接保存 |
||||
*/ |
||||
void saveDirectly(); |
||||
|
||||
|
||||
/** |
||||
* 直接另存为 |
||||
*/ |
||||
void saveAsDirectly(); |
||||
|
||||
} |
@ -0,0 +1,93 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.dialog.link.MessageWithLink; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.Container; |
||||
import java.awt.Dimension; |
||||
import java.awt.LayoutManager; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.HyperlinkEvent; |
||||
import javax.swing.event.HyperlinkListener; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/20 |
||||
*/ |
||||
public class OpenFailedPane extends JPanel { |
||||
|
||||
private UILabel label; |
||||
private MessageWithLink link; |
||||
|
||||
public OpenFailedPane() { |
||||
this.setLayout(new LayoutManager() { |
||||
@Override |
||||
public void addLayoutComponent(String name, Component comp) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void removeLayoutComponent(Component comp) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Dimension preferredLayoutSize(Container parent) { |
||||
return parent.getPreferredSize(); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension minimumLayoutSize(Container parent) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void layoutContainer(Container parent) { |
||||
int width = parent.getParent().getWidth(); |
||||
int height = parent.getParent().getHeight(); |
||||
int labelWidth = label.getPreferredSize().width; |
||||
int labelHeight = label.getPreferredSize().height; |
||||
int labelX = (width - labelWidth) / 2; |
||||
int labelY = (height - labelHeight) / 2; |
||||
int linkWidth = link.getPreferredSize().width; |
||||
int linkHeight = link.getPreferredSize().height; |
||||
int linkX = (width - linkWidth) / 2; |
||||
int linkY = (height - labelHeight) / 2 + labelHeight; |
||||
label.setBounds(labelX, labelY, labelWidth, labelHeight); |
||||
link.setBounds(linkX, linkY, linkWidth, linkHeight); |
||||
} |
||||
}); |
||||
this.setBackground(Color.WHITE); |
||||
label = new UILabel(IOUtils.readIcon("/com/fr/design/images/mainframe/open_failed.png"), UILabel.CENTER); |
||||
link = new MessageWithLink(Toolkit.i18nText("Fine-Design_Open_Failed_Tip"), Toolkit.i18nText("Fine-Design_Open_Failed_Retry"), StringUtils.EMPTY, Color.WHITE) { |
||||
@Override |
||||
protected void initListener(String link) { |
||||
addHyperlinkListener(new HyperlinkListener() { |
||||
@Override |
||||
public void hyperlinkUpdate(HyperlinkEvent e) { |
||||
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); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
link.setBackground(Color.WHITE); |
||||
this.add(label); |
||||
this.add(link); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.general.IOUtils; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.Container; |
||||
import java.awt.Dimension; |
||||
import java.awt.LayoutManager; |
||||
import javax.swing.ImageIcon; |
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/9 |
||||
*/ |
||||
public class OpenLoadingPane extends JPanel { |
||||
|
||||
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.gif")); |
||||
|
||||
private UILabel loadingLabel; |
||||
|
||||
public OpenLoadingPane() { |
||||
|
||||
setLayout(new LayoutManager() { |
||||
|
||||
@Override |
||||
public void removeLayoutComponent(Component comp) { |
||||
} |
||||
|
||||
@Override |
||||
public Dimension preferredLayoutSize(Container parent) { |
||||
return parent.getPreferredSize(); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension minimumLayoutSize(Container parent) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
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 loadingLabelX = (width - loadingLabelWidth) / 2; |
||||
int loadingLabelY = (height - loadingLabelHeight) / 2; |
||||
loadingLabel.setBounds(loadingLabelX, loadingLabelY, loadingLabelWidth, loadingLabelHeight); |
||||
} |
||||
|
||||
@Override |
||||
public void addLayoutComponent(String name, Component comp) { |
||||
} |
||||
}); |
||||
setBackground(Color.WHITE); |
||||
loadingLabel = new UILabel(LOADING_ICON); |
||||
add(loadingLabel); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.stable.StableUtils; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/12 |
||||
*/ |
||||
public class TemplateSavingChecker { |
||||
|
||||
|
||||
public static boolean check() { |
||||
List<String> list = getSavingTemplate(); |
||||
if (!list.isEmpty()) { |
||||
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
||||
Toolkit.i18nText("Fine-Design_Close_Template_Tip", StableUtils.join(list, "、")), |
||||
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
||||
FineJOptionPane.INFORMATION_MESSAGE); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
|
||||
private static List<String> getSavingTemplate() { |
||||
List<String> result = new ArrayList<>(); |
||||
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) { |
||||
if (template.isSaving()) { |
||||
result.add(template.getEditingFILE().getName()); |
||||
} |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,162 @@
|
||||
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; |
||||
import java.awt.Container; |
||||
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 implements ActionListener { |
||||
|
||||
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() { |
||||
|
||||
addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
// do nothing
|
||||
} |
||||
}); |
||||
|
||||
setLayout(getCoverLayout()); |
||||
setBackground(null); |
||||
setOpaque(false); |
||||
label = new UILabel(Toolkit.i18nText("Fine-Design_Saving_Template_Tip")); |
||||
add(label); |
||||
} |
||||
|
||||
protected LayoutManager getCoverLayout() { |
||||
return new LayoutManager() { |
||||
|
||||
@Override |
||||
public void removeLayoutComponent(Component comp) { |
||||
} |
||||
|
||||
@Override |
||||
public Dimension preferredLayoutSize(Container parent) { |
||||
return parent.getPreferredSize(); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension minimumLayoutSize(Container parent) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void layoutContainer(Container parent) { |
||||
int width = parent.getParent().getWidth(); |
||||
int height = parent.getParent().getHeight(); |
||||
int labelWidth = label.getPreferredSize().width; |
||||
int labelHeight = label.getPreferredSize().height; |
||||
int labelX = (width - labelWidth) / 2; |
||||
int labelY = (int) ((height - labelHeight) * prec); |
||||
label.setBounds(labelX, labelY, labelWidth, labelHeight); |
||||
} |
||||
|
||||
@Override |
||||
public void addLayoutComponent(String name, Component comp) { |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void paint(Graphics g) { |
||||
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; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,214 @@
|
||||
package com.fr.design.mainframe.check; |
||||
|
||||
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.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.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.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.WindowAdapter; |
||||
import java.awt.event.WindowEvent; |
||||
import java.util.Set; |
||||
import java.util.concurrent.ExecutionException; |
||||
|
||||
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; |
||||
|
||||
public class CheckButton extends UIButton { |
||||
|
||||
private UILabel message; |
||||
private UIButton okButton; |
||||
private JDialog dialog; |
||||
private UILabel uiLabel; |
||||
|
||||
public CheckButton() { |
||||
this.setIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/check.png")); |
||||
this.setToolTipText(Toolkit.i18nText("Fine_Designer_Check_Font")); |
||||
this.set4ToolbarButton(); |
||||
this.addActionListener(checkListener); |
||||
} |
||||
|
||||
private ActionListener checkListener = new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
|
||||
// Try check
|
||||
final SwingWorker<Set<String>, Void> checkThread = new SwingWorker<Set<String>, Void>() { |
||||
@Override |
||||
protected Set<String> doInBackground() throws Exception { |
||||
// 返回校验结果
|
||||
return check(DesignerContext.getDesignerFrame().getSelectedJTemplate()); |
||||
} |
||||
|
||||
@Override |
||||
protected void done() { |
||||
try { |
||||
Set<String> set = get(); |
||||
if (set == null) { |
||||
return; |
||||
} |
||||
if (set.isEmpty()) { |
||||
okButton.setEnabled(true); |
||||
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png")); |
||||
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + "</html>"); |
||||
} else { |
||||
if (dialog != null) { |
||||
dialog.dispose(); |
||||
} |
||||
StringBuilder textBuilder = new StringBuilder(); |
||||
textBuilder.append(Toolkit.i18nText("Fine_Designer_Check_Font_Missing_Font")).append("\n"); |
||||
for (String font : set) { |
||||
textBuilder.append(font).append("\n"); |
||||
} |
||||
String areaText = textBuilder.toString(); |
||||
CheckFontInfoDialog dialog = new CheckFontInfoDialog(DesignerContext.getDesignerFrame(), areaText); |
||||
dialog.setVisible(true); |
||||
} |
||||
} catch (InterruptedException | ExecutionException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
JTemplate<?, ?> jtemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); |
||||
if (jtemplate == null || jtemplate.getEditingFILE() == null) { |
||||
return; |
||||
} |
||||
FILE currentTemplate = jtemplate.getEditingFILE(); |
||||
if (currentTemplate instanceof FileNodeFILE) { |
||||
// 判断下模板是否存在 不存在先提示
|
||||
if (!currentTemplate.exists()) { |
||||
int selVal = showConfirmDialog( |
||||
DesignerContext.getDesignerFrame(), |
||||
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), |
||||
Toolkit.i18nText("Fine_Designer_Check_Font"), |
||||
OK_CANCEL_OPTION, |
||||
WARNING_MESSAGE |
||||
); |
||||
if (OK_OPTION == selVal) { |
||||
CallbackSaveWorker worker = jtemplate.saveAs(); |
||||
worker.addSuccessCallback(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
startCheck(checkThread); |
||||
} |
||||
}); |
||||
worker.start(jtemplate.getTarget().getTemplateID()); |
||||
} |
||||
} else { |
||||
if (!jtemplate.isSaved()) { |
||||
CallbackSaveWorker worker = jtemplate.save(); |
||||
worker.addSuccessCallback(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
startCheck(checkThread); |
||||
} |
||||
}); |
||||
worker.start(jtemplate.getTarget().getTemplateID()); |
||||
} else { |
||||
startCheck(checkThread); |
||||
} |
||||
} |
||||
} else { |
||||
//模板不在报表环境下,提示保存
|
||||
int selVal = FineJOptionPane.showConfirmDialog( |
||||
DesignerContext.getDesignerFrame(), |
||||
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), |
||||
Toolkit.i18nText("Fine_Designer_Check_Font"), |
||||
OK_CANCEL_OPTION, |
||||
WARNING_MESSAGE); |
||||
if (OK_OPTION == selVal) { |
||||
CallbackSaveWorker worker = jtemplate.saveAs2Env(); |
||||
worker.addSuccessCallback(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
startCheck(checkThread); |
||||
} |
||||
}); |
||||
worker.start(jtemplate.getTarget().getTemplateID()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void startCheck(SwingWorker<Set<String>, Void> checkThread) { |
||||
initDialogPane(); |
||||
dialog.addWindowListener(new WindowAdapter() { |
||||
public void windowClosed(WindowEvent e) { |
||||
checkThread.cancel(true); |
||||
} |
||||
}); |
||||
checkThread.execute(); |
||||
dialog.setVisible(true); |
||||
dialog.dispose(); |
||||
} |
||||
}; |
||||
|
||||
private Set<String> check(JTemplate jtemplate) { |
||||
String path = jtemplate.getEditingFILE().getEnvFullName(); |
||||
Set<String> fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler<Void>() { |
||||
|
||||
@Override |
||||
public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { |
||||
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/error.png")); |
||||
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>"); |
||||
okButton.setEnabled(true); |
||||
return null; |
||||
} |
||||
}).checkFont(path); |
||||
return fontSet; |
||||
} |
||||
|
||||
private void initDialogPane() { |
||||
message = new UILabel(); |
||||
message.setText(Toolkit.i18nText("Fine-Designer_Check_Font_Checking") + "..."); |
||||
uiLabel = new UILabel(); |
||||
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); |
||||
okButton.setEnabled(false); |
||||
okButton.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
dialog.dispose(); |
||||
} |
||||
}); |
||||
dialog = new JDialog(); |
||||
dialog.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font")); |
||||
dialog.setModal(true); |
||||
dialog.setSize(new Dimension(268, 118)); |
||||
JPanel jp = new JPanel(); |
||||
JPanel upPane = new JPanel(); |
||||
JPanel downPane = new JPanel(); |
||||
uiLabel = new UILabel(BaseUtils.readIcon("com/fr/design/images/waiting.png")); |
||||
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); |
||||
upPane.add(uiLabel); |
||||
upPane.add(message); |
||||
downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); |
||||
downPane.add(okButton); |
||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||
jp.add(upPane); |
||||
jp.add(downPane); |
||||
dialog.add(jp); |
||||
dialog.setResizable(false); |
||||
dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(this)); |
||||
} |
||||
} |
@ -0,0 +1,126 @@
|
||||
package com.fr.design.mainframe.check; |
||||
|
||||
import com.fr.design.dialog.link.MessageWithLink; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.IOUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JDialog; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JScrollPane; |
||||
import javax.swing.JTextArea; |
||||
import javax.swing.UIManager; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
import java.util.Locale; |
||||
|
||||
/** |
||||
* 字体缺失检测的具体结果对话框 |
||||
* |
||||
*/ |
||||
public class CheckFontInfoDialog extends JDialog implements ActionListener { |
||||
|
||||
private JPanel topPanel; |
||||
private JPanel upInTopPanel; |
||||
private JPanel downInTopPanel; |
||||
private JPanel hiddenPanel; |
||||
private JPanel bottomPanel; |
||||
|
||||
private UILabel imageLabel; |
||||
private UILabel directUiLabel; |
||||
private UILabel detailLabel; |
||||
|
||||
public CheckFontInfoDialog(Frame parent, String areaText) { |
||||
super(parent,true); |
||||
//提示信息
|
||||
JPanel imagePanel = new JPanel(); |
||||
imageLabel = new UILabel(IOUtils.readIcon("com/fr/design/images/warnings/warning32.png")); |
||||
imagePanel.add(imageLabel); |
||||
|
||||
JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); |
||||
MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"), |
||||
Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"), |
||||
CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html")); |
||||
linkMessage.setPreferredSize(new Dimension(380, 31)); |
||||
messagePanel.add(linkMessage); |
||||
|
||||
// 查看详情按钮
|
||||
directUiLabel = new UILabel(); |
||||
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); |
||||
detailLabel = new UILabel(); |
||||
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); |
||||
|
||||
upInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
upInTopPanel.add(imageLabel, BorderLayout.WEST); |
||||
upInTopPanel.add(messagePanel, BorderLayout.CENTER); |
||||
|
||||
downInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
downInTopPanel.add(directUiLabel, BorderLayout.WEST); |
||||
downInTopPanel.add(detailLabel, BorderLayout.CENTER); |
||||
|
||||
topPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); |
||||
topPanel.add(upInTopPanel, BorderLayout.NORTH); |
||||
topPanel.add(downInTopPanel, BorderLayout.SOUTH); |
||||
|
||||
//中间的详情展示(可隐藏)
|
||||
hiddenPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
hiddenPanel.setBorder(BorderFactory.createEmptyBorder(0,12,0,12)); |
||||
JScrollPane scrollPane = new JScrollPane(); |
||||
JTextArea checkArea = new JTextArea(areaText); |
||||
scrollPane.setViewportView(checkArea); |
||||
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
||||
checkArea.setEnabled(false); |
||||
hiddenPanel.add(scrollPane); |
||||
hiddenPanel.setVisible(false); |
||||
|
||||
downInTopPanel.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
if (hiddenPanel.isVisible()) { |
||||
hiddenPanel.setVisible(false); |
||||
CheckFontInfoDialog.this.setSize(new Dimension(380, 185)); |
||||
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); |
||||
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); |
||||
} else { |
||||
CheckFontInfoDialog.this.setSize(new Dimension(380, 280)); |
||||
hiddenPanel.setVisible(true); |
||||
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail")); |
||||
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down")); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
//底部的按钮面板
|
||||
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); |
||||
okButton.addActionListener(this); |
||||
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
bottomPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); |
||||
bottomPanel.add(okButton, BorderLayout.EAST); |
||||
|
||||
this.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font")); |
||||
this.setResizable(false); |
||||
|
||||
this.add(topPanel, BorderLayout.NORTH); |
||||
this.add(hiddenPanel, BorderLayout.CENTER); |
||||
this.add(bottomPanel, BorderLayout.SOUTH); |
||||
this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 400:380, 185)); |
||||
|
||||
GUICoreUtils.centerWindow(this); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
this.dispose(); |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.worker; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import javax.swing.SwingWorker; |
||||
import org.jetbrains.annotations.Nullable; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/2 |
||||
*/ |
||||
public class WorkerManager { |
||||
|
||||
private static final WorkerManager INSTANCE = new WorkerManager(); |
||||
|
||||
private Map<String, SwingWorker> workerMap = new HashMap<>(); |
||||
|
||||
public static WorkerManager getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
@Nullable |
||||
public SwingWorker getWorker(String taskName) { |
||||
return workerMap.get(taskName); |
||||
} |
||||
|
||||
public boolean isCompleted(String taskName) { |
||||
SwingWorker worker = getWorker(taskName); |
||||
return worker == null || worker.isDone(); |
||||
} |
||||
|
||||
public void registerWorker(String taskName, SwingWorker worker) { |
||||
workerMap.put(taskName, worker); |
||||
} |
||||
|
||||
public void removeWorker(String taskName) { |
||||
workerMap.remove(taskName); |
||||
} |
||||
|
||||
public void cancelWorker(String taskName) { |
||||
SwingWorker worker = getWorker(taskName); |
||||
if (worker != null && !worker.isDone()) { |
||||
worker.cancel(true); |
||||
removeWorker(taskName); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.design.worker.open; |
||||
|
||||
import com.fr.base.io.BaseBook; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/13 |
||||
*/ |
||||
public class OpenResult<T extends BaseBook, R> { |
||||
|
||||
private final T baseBook; |
||||
|
||||
private final R ref; |
||||
|
||||
public OpenResult(T baseBook, R r) { |
||||
this.baseBook = baseBook; |
||||
this.ref = r; |
||||
} |
||||
|
||||
public T getBaseBook() { |
||||
return baseBook; |
||||
} |
||||
|
||||
public R getRef() { |
||||
return ref; |
||||
} |
||||
} |
@ -0,0 +1,154 @@
|
||||
package com.fr.design.worker.open; |
||||
|
||||
import com.fr.base.chart.exception.ChartNotFoundException; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.worker.WorkerManager; |
||||
import com.fr.exception.DecryptTemplateException; |
||||
import com.fr.file.FILE; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.log.FineLoggerFactory; |
||||
|
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.SwingWorker; |
||||
import javax.swing.UIManager; |
||||
import java.util.concurrent.Callable; |
||||
import java.util.concurrent.CancellationException; |
||||
import java.util.concurrent.TimeUnit; |
||||
import java.util.concurrent.TimeoutException; |
||||
|
||||
/** |
||||
* 模板打开的worker |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/9 |
||||
*/ |
||||
public class OpenWorker<T> extends SwingWorker<T, Void> { |
||||
|
||||
private static final int TIME_OUT = 400; |
||||
|
||||
private final Callable<T> callable; |
||||
|
||||
private final JTemplate<?, ?> template; |
||||
|
||||
private Callable<JTemplate<?, ?>> templateCallable; |
||||
|
||||
private boolean slowly = false; |
||||
|
||||
private String taskName; |
||||
|
||||
private T result; |
||||
|
||||
public OpenWorker(Callable<T> callable, JTemplate<?, ?> template) { |
||||
this.callable = callable; |
||||
this.template = template; |
||||
} |
||||
|
||||
@Override |
||||
protected T doInBackground() throws Exception { |
||||
return this.callable.call(); |
||||
} |
||||
|
||||
@Override |
||||
protected void done() { |
||||
try { |
||||
result = get(); |
||||
} catch (CancellationException ignored) { |
||||
return; |
||||
} catch (Throwable t) { |
||||
processFailed(); |
||||
Throwable cause = t.getCause(); |
||||
if (cause instanceof DecryptTemplateException) { |
||||
FineJOptionPane.showMessageDialog( |
||||
DesignerContext.getDesignerFrame(), |
||||
Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), |
||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
||||
JOptionPane.WARNING_MESSAGE, |
||||
UIManager.getIcon("OptionPane.errorIcon") |
||||
); |
||||
} |
||||
if (cause instanceof ChartNotFoundException) { |
||||
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
||||
Toolkit.i18nText("Fine-Design_Chart_Not_Found_Exception"), |
||||
Toolkit.i18nText("Fine-Design_Basic_Error"), |
||||
JOptionPane.ERROR_MESSAGE, |
||||
UIManager.getIcon("OptionPane.errorIcon")); |
||||
} |
||||
FineLoggerFactory.getLogger().error(t.getMessage(), t); |
||||
return; |
||||
} |
||||
// 后续动作
|
||||
processResult(); |
||||
} |
||||
|
||||
private void processResult() { |
||||
this.template.setOpening(false); |
||||
if (slowly && templateCallable != null) { |
||||
try { |
||||
JTemplate<?, ?> book = templateCallable.call(); |
||||
FILE tplFile = book.getEditingFILE(); |
||||
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
// 当前tab页是正在打开的模板
|
||||
if (ComparatorUtils.equals(currentTemplate.getEditingFILE(), tplFile)) { |
||||
currentTemplate.whenClose(); |
||||
DesignerContext.getDesignerFrame().addAndActivateJTemplate(book); |
||||
HistoryTemplateListCache.getInstance().replaceCurrentEditingTemplate(book); |
||||
} else { |
||||
// 当前tab页是其他模板
|
||||
for (int i = 0, len = HistoryTemplateListCache.getInstance().getHistoryCount(); i < len; i++) { |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getTemplate(i); |
||||
if (ComparatorUtils.equals(template.getEditingFILE(), book.getEditingFILE())) { |
||||
template.whenClose(); |
||||
HistoryTemplateListCache.getInstance().getHistoryList().set(i, book); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
DesignerFrameFileDealerPane.getInstance().stateChange(); |
||||
WorkerManager.getInstance().removeWorker(taskName); |
||||
} |
||||
|
||||
private void processFailed() { |
||||
this.template.setOpenFailed(true); |
||||
this.template.setOpening(false); |
||||
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover(); |
||||
DesignerFrameFileDealerPane.getInstance().stateChange(); |
||||
WorkerManager.getInstance().removeWorker(taskName); |
||||
|
||||
} |
||||
|
||||
public void addCallBack(Callable<JTemplate<?, ?>> templateCallable) { |
||||
this.templateCallable = templateCallable; |
||||
} |
||||
|
||||
public void start(String taskName) { |
||||
this.taskName = taskName; |
||||
this.template.setOpening(true); |
||||
this.execute(); |
||||
WorkerManager.getInstance().registerWorker(taskName, this); |
||||
} |
||||
|
||||
public T getResult() { |
||||
if (result != null) { |
||||
return result; |
||||
} |
||||
try { |
||||
return this.get(TIME_OUT, TimeUnit.MILLISECONDS); |
||||
} catch (TimeoutException e) { |
||||
slowly = true; |
||||
} catch (Exception exception) { |
||||
FineLoggerFactory.getLogger().error(exception.getMessage(), exception); |
||||
WorkerManager.getInstance().removeWorker(taskName); |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,75 @@
|
||||
package com.fr.design.worker.save; |
||||
|
||||
import com.fr.common.util.Collections; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import java.util.LinkedList; |
||||
import java.util.List; |
||||
import java.util.concurrent.Callable; |
||||
|
||||
/** |
||||
* 保存之后需要做些外部回调 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/8 |
||||
*/ |
||||
public class CallbackSaveWorker extends SaveWorker { |
||||
|
||||
private List<Runnable> successRunnableList; |
||||
|
||||
private List<Runnable> failRunnableList; |
||||
|
||||
public CallbackSaveWorker(Callable<Boolean> callable, JTemplate<?, ?> template) { |
||||
super(callable, template); |
||||
} |
||||
|
||||
@Override |
||||
protected void done() { |
||||
super.done(); |
||||
|
||||
if (success) { |
||||
fireRunnable(successRunnableList); |
||||
} else { |
||||
fireRunnable(failRunnableList); |
||||
} |
||||
successRunnableList = null; |
||||
failRunnableList = null; |
||||
} |
||||
|
||||
private void fireRunnable(List<Runnable> list) { |
||||
if (Collections.isEmpty(list)) { |
||||
return; |
||||
} |
||||
for (Runnable runnable : list) { |
||||
runnable.run(); |
||||
} |
||||
} |
||||
|
||||
private void addCallback(List<Runnable> runnableList, Runnable runnable) { |
||||
if (runnableList == null) { |
||||
runnableList = new LinkedList<>(); |
||||
} |
||||
if (runnable != null) { |
||||
runnableList.add(runnable); |
||||
} |
||||
} |
||||
|
||||
public void addSuccessCallback(Runnable successRunnable) { |
||||
if (successRunnableList == null) { |
||||
successRunnableList = new LinkedList<>(); |
||||
} |
||||
if (successRunnable != null) { |
||||
successRunnableList.add(successRunnable); |
||||
} |
||||
} |
||||
|
||||
public void addFailCallback(Runnable failRunnable) { |
||||
if (failRunnableList == null) { |
||||
failRunnableList = new LinkedList<>(); |
||||
} |
||||
if (failRunnable != null) { |
||||
failRunnableList.add(failRunnable); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.worker.save; |
||||
|
||||
import com.fr.design.mainframe.JTemplate; |
||||
import java.util.concurrent.Callable; |
||||
|
||||
/** |
||||
* 空实现 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/9 |
||||
*/ |
||||
public class EmptyCallBackSaveWorker extends CallbackSaveWorker { |
||||
|
||||
public EmptyCallBackSaveWorker(Callable<Boolean> callable, JTemplate<?, ?> template) { |
||||
super(callable, template); |
||||
} |
||||
|
||||
public EmptyCallBackSaveWorker() { |
||||
this(null, null); |
||||
} |
||||
|
||||
@Override |
||||
protected Boolean doInBackground() throws Exception { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
protected void done() { |
||||
// do nothing
|
||||
} |
||||
|
||||
@Override |
||||
public void start(String taskName) { |
||||
// do nothing
|
||||
} |
||||
} |
@ -0,0 +1,99 @@
|
||||
package com.fr.design.worker.save; |
||||
|
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
||||
import com.fr.design.mainframe.EastRegionContainerPane; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.worker.WorkerManager; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import java.awt.Frame; |
||||
import java.util.concurrent.Callable; |
||||
import java.util.concurrent.TimeUnit; |
||||
import java.util.concurrent.TimeoutException; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.SwingWorker; |
||||
|
||||
/** |
||||
* 模板保存的worker |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/4/1 |
||||
*/ |
||||
public class SaveWorker extends SwingWorker<Boolean, Void> { |
||||
|
||||
private static final int TIME_OUT = 400; |
||||
|
||||
private final Callable<Boolean> callable; |
||||
|
||||
private String taskName; |
||||
|
||||
private final JTemplate<?, ?> template; |
||||
|
||||
protected boolean success; |
||||
|
||||
private boolean slowly; |
||||
|
||||
public SaveWorker(Callable<Boolean> callable, JTemplate<?, ?> template) { |
||||
this.callable = callable; |
||||
this.template = template; |
||||
} |
||||
|
||||
@Override |
||||
protected Boolean doInBackground() throws Exception { |
||||
return callable.call(); |
||||
} |
||||
|
||||
@Override |
||||
protected void done() { |
||||
try { |
||||
success = get(); |
||||
} catch (Exception e) { |
||||
processResult(); |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
boolean minimized = (DesignerContext.getDesignerFrame().getExtendedState() & Frame.ICONIFIED ) != 0; |
||||
FineJOptionPane.showMessageDialog( |
||||
minimized ? null : DesignerContext.getDesignerFrame(), |
||||
Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
||||
JOptionPane.ERROR_MESSAGE); |
||||
return; |
||||
} |
||||
processResult(); |
||||
} |
||||
|
||||
private void processResult() { |
||||
this.template.setSaving(false); |
||||
// 恢复界面
|
||||
if (slowly && ComparatorUtils.equals(this.template.getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) { |
||||
DesignerContext.getDesignerFrame().refreshUIToolBar(); |
||||
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover(); |
||||
} |
||||
DesignerFrameFileDealerPane.getInstance().stateChange(); |
||||
WorkerManager.getInstance().removeWorker(taskName); |
||||
} |
||||
|
||||
public void start(String taskName) { |
||||
this.taskName = taskName; |
||||
this.template.setSaving(true); |
||||
this.execute(); |
||||
// worker纳入管理
|
||||
WorkerManager.getInstance().registerWorker(taskName, this); |
||||
try { |
||||
this.get(TIME_OUT, TimeUnit.MILLISECONDS); |
||||
} catch (TimeoutException timeoutException) { |
||||
slowly = true; |
||||
// 开始禁用
|
||||
EastRegionContainerPane.getInstance().updateAllPropertyPane(); |
||||
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showCover(); |
||||
DesignerFrameFileDealerPane.getInstance().stateChange(); |
||||
} catch (Exception exception) { |
||||
FineLoggerFactory.getLogger().error(exception.getMessage(), exception); |
||||
WorkerManager.getInstance().removeWorker(taskName); |
||||
} |
||||
} |
||||
} |
Before Width: | Height: | Size: 889 B After Width: | Height: | Size: 888 B |
After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 942 B After Width: | Height: | Size: 736 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 785 B |
After Width: | Height: | Size: 768 B |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 162 B |
After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 752 B After Width: | Height: | Size: 760 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1011 B |
After Width: | Height: | Size: 942 B |
@ -1,165 +0,0 @@
|
||||
/* |
||||
* Copyright(c) 2001-2011, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.chart.BaseChartCollection; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chartx.attr.ChartProvider; |
||||
import com.fr.design.ChartTypeInterfaceManager; |
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.design.gui.chart.BaseChartPropertyPane; |
||||
import com.fr.design.gui.chart.ChartEditPaneProvider; |
||||
import com.fr.design.gui.frpane.UITitlePanel; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itabpane.TitleChangeListener; |
||||
import com.fr.design.mainframe.chart.ChartEditPane; |
||||
import com.fr.stable.StableUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.Icon; |
||||
import javax.swing.JComponent; |
||||
import java.awt.BorderLayout; |
||||
|
||||
public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ |
||||
|
||||
protected TargetComponentContainer container = new TargetComponentContainer(); |
||||
protected UILabel nameLabel; |
||||
|
||||
protected ChartEditPane chartEditPane; |
||||
|
||||
public MiddleChartPropertyPane() { |
||||
initComponenet(); |
||||
} |
||||
|
||||
protected void initComponenet() { |
||||
this.setLayout(new BorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); |
||||
|
||||
createNameLabel(); |
||||
//去掉上方名字,先注释掉
|
||||
// this.add(createNorthComponent(), BorderLayout.NORTH);
|
||||
chartEditPane = StableUtils.construct(ChartEditPane.class); |
||||
chartEditPane.setSupportCellData(true); |
||||
} |
||||
|
||||
public void addChartEditPane(String plotID){ |
||||
chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID); |
||||
chartEditPane.setSupportCellData(true); |
||||
this.createMainPane(); |
||||
setSureProperty(); |
||||
} |
||||
|
||||
protected abstract void createNameLabel(); |
||||
|
||||
protected abstract JComponent createNorthComponent(); |
||||
|
||||
protected abstract void createMainPane(); |
||||
|
||||
|
||||
@Override |
||||
public ChartEditPaneProvider getChartEditPane() { |
||||
return chartEditPane; |
||||
} |
||||
|
||||
public void setSureProperty() { |
||||
chartEditPane.setContainer(container); |
||||
chartEditPane.addTitleChangeListener(titleListener); |
||||
String tabname = chartEditPane.getSelectedTabName(); |
||||
nameLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); |
||||
resetChartEditPane(); |
||||
} |
||||
|
||||
protected void resetChartEditPane() { |
||||
remove(chartEditPane); |
||||
add(chartEditPane, BorderLayout.CENTER); |
||||
validate(); |
||||
repaint(); |
||||
revalidate(); |
||||
} |
||||
|
||||
protected TitleChangeListener titleListener = new TitleChangeListener() { |
||||
|
||||
@Override |
||||
public void fireTitleChange(String addName) { |
||||
nameLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Property_Table") + '-' + addName); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 感觉ChartCollection加载图表属性界面. |
||||
* @param collection 收集图表 |
||||
* @param ePane 面板 |
||||
*/ |
||||
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) { |
||||
addChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID()); |
||||
setSupportCellData(true); |
||||
this.container.setEPane(ePane); |
||||
chartEditPane.populate(collection); |
||||
} |
||||
|
||||
/** |
||||
* 感觉ChartCollection加载图表属性界面. |
||||
* @param collection 收集图表 |
||||
* @param ePane 面板 |
||||
*/ |
||||
public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent<?> ePane) { |
||||
if (collection instanceof ChartCollection) { |
||||
populateChartPropertyPane((ChartCollection)collection, ePane); |
||||
} |
||||
} |
||||
|
||||
// public void clear() {
|
||||
// this.container.setEPane(null);
|
||||
// chartEditPane.clear();
|
||||
// getParent().remove(this);
|
||||
// }
|
||||
|
||||
/** |
||||
* 返回View的标题. |
||||
*/ |
||||
public String getViewTitle() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell_Element_Property_Table"); |
||||
} |
||||
|
||||
/** |
||||
* 返回View的Icon地址. |
||||
*/ |
||||
public Icon getViewIcon() { |
||||
return BaseUtils.readIcon("/com/fr/design/images/m_report/qb.png"); |
||||
} |
||||
|
||||
/** |
||||
* 预定义定位 |
||||
* @return 定位 |
||||
*/ |
||||
public Location preferredLocation() { |
||||
return Location.WEST_BELOW; |
||||
} |
||||
|
||||
/** |
||||
* 创建标题Panel |
||||
* @return 标题panel |
||||
*/ |
||||
public UITitlePanel createTitlePanel() { |
||||
return new UITitlePanel(this); |
||||
} |
||||
|
||||
/** |
||||
* 刷新Dockview |
||||
*/ |
||||
public void refreshDockingView() { |
||||
// TODO Auto-generated method stub
|
||||
|
||||
} |
||||
|
||||
/** |
||||
* 设置是否支持单元格数据. |
||||
*/ |
||||
public void setSupportCellData(boolean supportCellData) { |
||||
if(chartEditPane != null) { |
||||
chartEditPane.setSupportCellData(supportCellData); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.van.chart.designer.component.format; |
||||
|
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-04-06 |
||||
*/ |
||||
public class TargetValueFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { |
||||
|
||||
public TargetValueFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { |
||||
super(parent, showOnPane); |
||||
} |
||||
|
||||
@Override |
||||
protected String getCheckBoxText() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Target_Value"); |
||||
} |
||||
} |