roger
2 years ago
29 changed files with 813 additions and 81 deletions
@ -0,0 +1,70 @@
|
||||
package com.fr.design.extra.exe.callback.handle; |
||||
|
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.dialog.link.MessageWithLink; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.error.PluginErrorCode; |
||||
import com.fr.plugin.manage.control.PluginTaskResult; |
||||
|
||||
/** |
||||
* 帮助处理插件操作(安装、更新等)的弹窗 |
||||
* @author Yvan |
||||
*/ |
||||
public class PluginCallBackHelper { |
||||
|
||||
private static final String NEW_LINE_TAG = "<br/>"; |
||||
private static final String REFERENCE = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_Reference"); |
||||
private static final String HELP_DOCUMENT_NAME = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_NAME"); |
||||
private static final String CONNECTOR = "-"; |
||||
private static final String HELP_DOCUMENT_LINK = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_LINK"); |
||||
|
||||
|
||||
/** |
||||
* 展示插件操作失败后的提示弹窗 |
||||
* @param result |
||||
* @param pluginInfo |
||||
*/ |
||||
public static void showErrorMessage(PluginTaskResult result, String pluginInfo) { |
||||
// 单独处理下插件完整性校验失败的提示
|
||||
if (PluginCallBackHelper.needHandleInvalidatePackage(result)) { |
||||
MessageWithLink messageWithLink = PluginCallBackHelper.generate4InvalidatePackage(pluginInfo); |
||||
PluginTaskResultErrorDialog resultDialog = new PluginTaskResultErrorDialog(null, messageWithLink); |
||||
resultDialog.showResult(); |
||||
} else { |
||||
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断是否需要处理 插件安装包校验失败 导致的安装失败任务 |
||||
* @param result |
||||
* @return |
||||
*/ |
||||
private static boolean needHandleInvalidatePackage(PluginTaskResult result) { |
||||
return !result.isSuccess() && result.getCode() == PluginErrorCode.InstallPackageValidateFailed; |
||||
} |
||||
|
||||
/** |
||||
* 根据插件原始报错信息,构建MessageWithLink |
||||
* @param originInfo |
||||
* @return |
||||
*/ |
||||
private static MessageWithLink generate4InvalidatePackage(String originInfo) { |
||||
|
||||
return new MessageWithLink(getSupplementaryMessage(originInfo), HELP_DOCUMENT_NAME, HELP_DOCUMENT_LINK); |
||||
} |
||||
|
||||
/** |
||||
* 根据插件原始报错信息,获取增加了补充说明后的信息 |
||||
* @param originInfo |
||||
* @return |
||||
*/ |
||||
private static String getSupplementaryMessage(String originInfo) { |
||||
return new StringBuilder() |
||||
.append(originInfo) |
||||
.append(NEW_LINE_TAG) |
||||
.append(REFERENCE) |
||||
.append(CONNECTOR) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,86 @@
|
||||
package com.fr.design.extra.exe.callback.handle; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
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.layout.VerticalFlowLayout; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JDialog; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* 当前仅处理Error提示,之后有需要再扩展 |
||||
* @author Yvan |
||||
*/ |
||||
public class PluginTaskResultErrorDialog extends JDialog { |
||||
|
||||
private static final Dimension LABEL = new Dimension(60, 90); |
||||
|
||||
private JPanel contentPane; |
||||
|
||||
private UILabel errorLabel; |
||||
|
||||
private UIButton confirmButton; |
||||
|
||||
private MessageWithLink messageWithLink; |
||||
|
||||
public PluginTaskResultErrorDialog(Frame parent, MessageWithLink messageWithLink) { |
||||
super(parent, true); |
||||
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning")); |
||||
this.messageWithLink = messageWithLink; |
||||
|
||||
initContentPane(); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setResizable(false); |
||||
this.add(contentPane, BorderLayout.CENTER); |
||||
this.setSize(new Dimension( 380, 160)); |
||||
GUICoreUtils.centerWindow(this); |
||||
} |
||||
|
||||
/** |
||||
* 初始化内容面板 |
||||
*/ |
||||
private void initContentPane() { |
||||
this.contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
// error图标
|
||||
errorLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/error_tips.svg")); |
||||
errorLabel.setPreferredSize(LABEL); |
||||
errorLabel.setBorder(BorderFactory.createEmptyBorder(10, 20, 40, 20)); |
||||
// 提示内容
|
||||
JPanel messagePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
messagePane.add(errorLabel, BorderLayout.WEST); |
||||
messagePane.add(messageWithLink, BorderLayout.CENTER); |
||||
messagePane.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 10)); |
||||
this.contentPane.add(messagePane, BorderLayout.CENTER); |
||||
// 确定按钮
|
||||
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_OK")); |
||||
confirmButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
hideResult(); |
||||
} |
||||
}); |
||||
JPanel confirmPane = new JPanel(new VerticalFlowLayout()); |
||||
confirmPane.add(confirmButton); |
||||
confirmPane.setBorder(BorderFactory.createEmptyBorder(0, 160, 10, 0)); |
||||
this.contentPane.add(confirmPane, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
public void showResult() { |
||||
this.setVisible(true); |
||||
} |
||||
|
||||
public void hideResult() { |
||||
this.setVisible(false); |
||||
} |
||||
} |
@ -0,0 +1,207 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.DesignModelAdapter; |
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.design.gui.frpane.HyperlinkGroupPane; |
||||
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; |
||||
import com.fr.design.gui.imenu.UIMenuItem; |
||||
import com.fr.design.mainframe.template.info.TemplateProcessInfo; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.design.menu.ToolBarDef; |
||||
|
||||
import javax.swing.Icon; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* created by Harrison on 2022/08/09 |
||||
**/ |
||||
public class JNullTemplate extends JTemplate { |
||||
|
||||
public static final JTemplate NULL = new JNullTemplate(); |
||||
|
||||
@Override |
||||
public void copy() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean paste() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean cut() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public AuthorityEditPane createAuthorityEditPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JPanel getEastUpPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JPanel getEastDownPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ToolBarDef[] toolbars4Target() { |
||||
return new ToolBarDef[0]; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent[] toolBarButton4Form() { |
||||
return new JComponent[0]; |
||||
} |
||||
|
||||
@Override |
||||
public void refreshEastPropertiesPane() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public TargetComponent getCurrentElementCasePane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent getCurrentReportComponentPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public TemplateProcessInfo getProcessInfo() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void setJTemplateResolution(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public int getJTemplateResolution() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
protected JComponent createCenterPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void removeTemplateSelection() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void refreshContainer() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void removeParameterPaneSelection() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void setScale(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public int getScale() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int selfAdaptUpdate() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
protected DesignModelAdapter createDesignModel() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public UIMenuItem[] createMenuItem4Preview() { |
||||
return new UIMenuItem[0]; |
||||
} |
||||
|
||||
@Override |
||||
protected BaseUndoState<?> createUndoState() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void applyUndoState(BaseUndoState baseUndoState) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String suffix() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ShortCut[] shortcut4TemplateMenu() { |
||||
return new ShortCut[0]; |
||||
} |
||||
|
||||
@Override |
||||
public ShortCut[] shortCuts4Authority() { |
||||
return new ShortCut[0]; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isJWorkBook() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void setAuthorityMode(boolean isUpMode) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Icon getIcon() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String route() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JPanel[] toolbarPanes4Form() { |
||||
return new JPanel[0]; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent toolBar4Authority() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public int getToolBarHeight() { |
||||
return 0; |
||||
} |
||||
} |
@ -0,0 +1,83 @@
|
||||
package com.fr.design.mainframe.simple; |
||||
|
||||
import com.fr.json.JSONObject; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLable; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Wei |
||||
* 一个简单属性(字符串)存储类,用于自定义简单属性的存储 |
||||
* 如:getInstance("FVSDesignerConfig")可在FineReportEnv.xml中定义一个<FVSDesignerConfig></>存储FVS相关配置 |
||||
*/ |
||||
public class SimpleDesignerConfig implements XMLable { |
||||
|
||||
private static final Map<String, SimpleDesignerConfig> configs = new HashMap<>(); |
||||
|
||||
private SimpleDesignerConfig(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public static SimpleDesignerConfig getInstance(String name) { |
||||
SimpleDesignerConfig config = configs.get(name); |
||||
if (config == null) { |
||||
config = new SimpleDesignerConfig(name); |
||||
configs.put(name, config); |
||||
} |
||||
return config; |
||||
} |
||||
|
||||
private String name = ""; |
||||
|
||||
private JSONObject content = new JSONObject(); |
||||
|
||||
public void addAttr(String key, String value) { |
||||
content.put(key, value); |
||||
} |
||||
|
||||
public JSONObject getContent() { |
||||
return content; |
||||
} |
||||
|
||||
public void setContent(JSONObject content) { |
||||
this.content = content; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
if (reader.isAttr()) { |
||||
String rawContent = reader.getAttrAsString("content", null); |
||||
if (StringUtils.isNotBlank(rawContent)) { |
||||
this.content = new JSONObject(rawContent); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
writer.startTAG(name); |
||||
if (this.content != null) { |
||||
writer.attr("content", this.content.toString()); |
||||
} |
||||
writer.end(); |
||||
} |
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
SimpleDesignerConfig cloned = (SimpleDesignerConfig) super.clone(); |
||||
if (this.content != null) { |
||||
cloned.content = new JSONObject(this.content.toString()); |
||||
} |
||||
cloned.name = this.name; |
||||
return cloned; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
} |
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,25 @@
|
||||
package com.fr.start.module.optimized; |
||||
|
||||
import com.fr.start.common.DesignerStartupContext; |
||||
import com.fr.update.activator.BasicUpdateActivator; |
||||
import com.fr.update.base.FineUpdateUnit; |
||||
|
||||
/** |
||||
* created by Harrison on 2022/08/11 |
||||
**/ |
||||
public class DesignUpdateActivator extends BasicUpdateActivator { |
||||
|
||||
@Override |
||||
public void start() { |
||||
|
||||
if (DesignerStartupContext.getInstance().onWarmup()) { |
||||
try { |
||||
prepare4Start(); |
||||
FineUpdateUnit.makeNew(); |
||||
} catch (Throwable ignore) { |
||||
} |
||||
} else { |
||||
super.start(); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue