Browse Source

Merge pull request #4384 in DESIGN/design from feature/10.0 to feature/big-screen

* commit 'ac67f3a096d451b56ff44061329aec31fe76651e':
  REPORT-51962【10.0.17】错误信息优化之模板缺失插件异常提示优化
  REPORT-51678  交互调整
  CHART-18965 自定义html框优化
feature/big-screen
superman 4 years ago
parent
commit
6f4502cc50
  1. 7
      designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java
  2. 328
      designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java
  3. 14
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  4. 9
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  5. 29
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  6. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java
  7. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  8. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java
  9. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java
  10. 65
      designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java

7
designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java

@ -7,5 +7,12 @@ public interface JSExecutor {
String CALLBACK_FUNCTION_NAME = "action"; String CALLBACK_FUNCTION_NAME = "action";
JSExecutor DEFAULT = new JSExecutor() {
@Override
public void executor(String newValue) {
// do nothing
}
};
void executor(String newValue); void executor(String newValue);
} }

328
designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java

@ -0,0 +1,328 @@
package com.fr.design.dialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* 可展开对话框
*
* <pre>
* UIExpandDialog.Builder()
* .owner(jf)
* .title("title")
* .messageType(UIExpandDialog.WARNING_MESSAGE)
* .message("message text")
* .detail("detail")
* .expand(false)
* .modal(false)
* .dialogActionListener(new DialogActionAdapter(){
* public void doOk() {
* System.out.println("OK");
* }
* }).build().setVisible(true);
* </pre>
*
* @author vito
* @version 10.0
* Created by vito on 2021/5/19
*/
public class UIExpandDialog extends UIDialog {
public static final int MARGIN = 10;
public static final int TEXT_AREA_ROW = 5;
public static final int GAP = 5;
public static final int ERROR_MESSAGE = 0;
public static final int INFORMATION_MESSAGE = 1;
public static final int WARNING_MESSAGE = 2;
public static final int QUESTION_MESSAGE = 3;
public static final String HTML_TAG_1 = "<html>";
public static final String HTML_TAG_2 = "</html>";
private final JPanel foldBar = new JPanel();
private final JPanel expandableContentPane = new JPanel();
private final UILabel narrow = new UILabel();
private final UILabel narrowHit = new UILabel();
private final UIButton buttonOK;
private final UIButton buttonCancel;
private JLabel msg;
private final UITextArea textArea = new UITextArea();
public UIExpandDialog(Frame owner, String title, boolean isModal,
int messageType, String message, String detail,
String okText, String cancelText, boolean isExpand) {
super(owner);
buttonOK = new UIButton(okText);
buttonCancel = new UIButton(cancelText);
setTitle(title);
setModal(isModal);
initComponents(messageType, message, detail, isModal, isExpand, null);
}
public UIExpandDialog(Builder builder) {
super(builder.owner);
buttonOK = new UIButton(builder.okText);
buttonCancel = new UIButton(builder.cancelText);
setTitle(builder.title);
setModal(builder.modal);
initComponents(builder.messageType, builder.message, builder.detail,
builder.modal, builder.expand, builder.dialogActionListener);
}
public void initComponents(int messageType, String message, String detail,
boolean isModal, boolean isExpand, DialogActionListener l) {
setLayout(new BorderLayout(GAP, GAP));
setResizable(false);
setModal(isModal);
getRootPane().setDefaultButton(buttonOK);
// 标题面板
UILabel icon = new UILabel(getIconForType(messageType));
msg = new JLabel(HTML_TAG_1 + message + HTML_TAG_2);
msg.setPreferredSize(new Dimension(300, 50));
JPanel mainMsg = new JPanel();
mainMsg.setLayout(new FlowLayout(FlowLayout.LEFT, MARGIN, MARGIN));
mainMsg.setPreferredSize(new Dimension(380, 60));
mainMsg.add(icon);
mainMsg.add(msg);
add(mainMsg, BorderLayout.NORTH);
// 内容面板
JPanel contentPanel = new JPanel();
contentPanel.setLayout(new BorderLayout(GAP, GAP));
foldBar.setLayout(new FlowLayout(FlowLayout.LEFT, MARGIN, 0));
foldBar.add(narrow);
foldBar.add(narrowHit);
contentPanel.add(foldBar, BorderLayout.NORTH);
textArea.setEditable(false);
textArea.setRows(TEXT_AREA_ROW);
textArea.setMargin(new Insets(GAP, GAP, GAP, GAP));
textArea.setEditable(false);
textArea.setText(detail);
UIScrollPane scrollPane = new UIScrollPane(textArea);
expandableContentPane.setLayout(new BorderLayout());
expandableContentPane.setBorder(BorderFactory.createEmptyBorder(0, MARGIN, 0, MARGIN));
expandableContentPane.add(scrollPane, BorderLayout.CENTER);
changeExpand(isExpand);
contentPanel.add(expandableContentPane, BorderLayout.CENTER);
add(contentPanel, BorderLayout.CENTER);
// 操作面板
JPanel actionPanel = new JPanel();
actionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, MARGIN, MARGIN));
actionPanel.add(buttonCancel);
actionPanel.add(buttonOK);
add(actionPanel, BorderLayout.SOUTH);
initListener();
if (l != null) {
addDialogActionListener(l);
}
pack();
if (getOwner() != null) {
GUICoreUtils.setWindowCenter(getOwner(), this);
}
}
private void changeExpand(boolean isExpand) {
if (isExpand) {
expandableContentPane.setVisible(true);
narrow.setIcon(UIManager.getIcon("OptionPane.narrow.down"));
narrowHit.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail"));
} else {
expandableContentPane.setVisible(false);
narrow.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
narrowHit.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
}
}
private void initListener() {
foldBar.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
changeExpand(!expandableContentPane.isShowing());
pack();
}
@Override
public void mouseEntered(MouseEvent e) {
foldBar.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
foldBar.setCursor(Cursor.getDefaultCursor());
}
});
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doOK();
}
});
buttonCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doCancel();
}
});
}
protected Icon getIconForType(int messageType) {
if (messageType < 0 || messageType > 3)
return null;
String propertyName;
switch (messageType) {
case 0:
propertyName = "OptionPane.errorIcon";
break;
case 1:
default:
propertyName = "OptionPane.informationIcon";
break;
case 2:
propertyName = "OptionPane.warningIcon";
break;
case 3:
propertyName = "OptionPane.questionIcon";
break;
}
return UIManager.getIcon(propertyName);
}
/**
* 设置对话框主消息
*
* @param message 消息内容
*/
public void setMessage(String message) {
msg.setText(HTML_TAG_1 + message + HTML_TAG_2);
}
/**
* 设置对话框消息详情
*
* @param detail 消息详情
*/
public void setDetail(String detail) {
textArea.setText(detail);
}
/**
* 设置详情面板展开关闭
*
* @param expand 展开或关闭
*/
public void setExpand(boolean expand) {
changeExpand(expand);
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
public static Builder Builder() {
return new UIExpandDialog.Builder();
}
public static final class Builder {
public int messageType = ERROR_MESSAGE;
public String title;
public String message;
public String detail;
public String okText = Toolkit.i18nText("Fine-Design_Report_OK");
public String cancelText = Toolkit.i18nText("Fine-Design_Basic_Cancel");
public boolean modal = true;
public boolean expand = true;
public Frame owner = null;
public DialogActionListener dialogActionListener = null;
private Builder() {
}
public UIExpandDialog build() {
return new UIExpandDialog(this);
}
public Builder owner(Frame owner) {
this.owner = owner;
return this;
}
public Builder messageType(int messageType) {
this.messageType = messageType;
return this;
}
public Builder title(String title) {
this.title = title;
return this;
}
public Builder message(String message) {
this.message = message;
return this;
}
public Builder detail(String detail) {
this.detail = detail;
return this;
}
public Builder okText(String okText) {
this.okText = okText;
return this;
}
public Builder cancelText(String cancelText) {
this.cancelText = cancelText;
return this;
}
public Builder modal(boolean modal) {
this.modal = modal;
return this;
}
public Builder expand(boolean expand) {
this.expand = expand;
return this;
}
public Builder dialogActionListener(DialogActionListener dialogActionListener) {
this.dialogActionListener = dialogActionListener;
return this;
}
}
@Override
public void checkValid() throws Exception {
}
}

14
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.bridge.exec.JSExecutor;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -17,9 +18,14 @@ import com.fr.plugin.manage.control.PluginTaskResult;
* Created by ibm on 2017/5/26. * Created by ibm on 2017/5/26.
*/ */
public class InstallOnlineCallback extends AbstractDealPreTaskCallback { public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
protected JSCallback jsCallback; protected JSCallback jsCallback = new JSCallback(JSExecutor.DEFAULT);
private static int HUNDRED_PERCENT = 100; private static int HUNDRED_PERCENT = 100;
public InstallOnlineCallback(PluginTask pluginTask) {
super(pluginTask);
}
public InstallOnlineCallback(PluginTask pluginTask, JSCallback jsCallback) { public InstallOnlineCallback(PluginTask pluginTask, JSCallback jsCallback) {
super(pluginTask); super(pluginTask);
this.jsCallback = jsCallback; this.jsCallback = jsCallback;
@ -27,7 +33,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
@Override @Override
public void updateProgress(String description, double aProgress) { public void updateProgress(String description, double aProgress) {
jsCallback.execute(String.valueOf(aProgress * HUNDRED_PERCENT + "%")); jsCallback.execute(aProgress * HUNDRED_PERCENT + "%");
} }
@ -51,8 +57,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
if (rv == FineJOptionPane.OK_OPTION) { if (rv == FineJOptionPane.OK_OPTION) {
PluginMarker pluginMarker = result.getCurrentTask().getMarker(); PluginMarker pluginMarker = result.getCurrentTask().getMarker();
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
} } else {
else {
jsCallback.execute("success"); jsCallback.execute("success");
} }
} else { } else {
@ -63,5 +68,4 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
} }
} }

9
designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.bridge.exec.JSExecutor;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -17,12 +18,18 @@ import javax.swing.JOptionPane;
*/ */
public class ModifyStatusCallback implements PluginTaskCallback { public class ModifyStatusCallback implements PluginTaskCallback {
private boolean isActive; private boolean isActive;
private JSCallback jsCallback; private JSCallback jsCallback = new JSCallback(JSExecutor.DEFAULT);
;
public ModifyStatusCallback(boolean isActive) {
this.isActive = isActive;
}
public ModifyStatusCallback(boolean isActive, JSCallback jsCallback) { public ModifyStatusCallback(boolean isActive, JSCallback jsCallback) {
this.isActive = isActive; this.isActive = isActive;
this.jsCallback = jsCallback; this.jsCallback = jsCallback;
} }
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result); String pluginInfo = PluginOperateUtils.getSuccessInfo(result);

29
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java

@ -11,9 +11,9 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.base.VanChartHtmlLabel; import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
@ -47,6 +47,8 @@ public class VanChartHtmlLabelPane extends JPanel{
private VanChartStylePane parent; private VanChartStylePane parent;
private JPanel widthAndHeightPane;
public void setCustomFormatterText(String text) { public void setCustomFormatterText(String text) {
contentTextArea.setText(text); contentTextArea.setText(text);
} }
@ -56,24 +58,28 @@ public class VanChartHtmlLabelPane extends JPanel{
} }
public VanChartHtmlLabelPane() { public VanChartHtmlLabelPane() {
useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); useHtml = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Html"));
UIComponentUtils.setLineWrap(useHtml); UIComponentUtils.setLineWrap(useHtml);
JPanel widthAndHeightPane = createWidthAndHeightPane(); useHtml.addChangeListener(e -> checkWidthAndHeightPane());
widthAndHeightPane = createWidthAndHeightPane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createJSContentPane()}, new Component[]{createJSContentPane()},
new Component[]{useHtml}, new Component[]{useHtml},
new Component[]{widthAndHeightPane} new Component[]{null, null},
}; };
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.NORTH);
if (widthAndHeightPane != null) {
this.add(widthAndHeightPane, BorderLayout.CENTER);
}
} }
private JComponent createJSContentPane() { private JComponent createJSContentPane() {
@ -127,9 +133,9 @@ public class VanChartHtmlLabelPane extends JPanel{
} }
protected JPanel createWidthAndHeightPane() { protected JPanel createWidthAndHeightPane() {
isCustomWidth = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Width")); isCustomWidth = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Custom_Width"));
customWidth = new UITextField(6); customWidth = new UITextField(6);
isCustomHeight = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Height")); isCustomHeight = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Custom_Height"));
customHeight = new UITextField(6); customHeight = new UITextField(6);
isCustomWidth.addActionListener(new ActionListener() { isCustomWidth.addActionListener(new ActionListener() {
@ -171,6 +177,12 @@ public class VanChartHtmlLabelPane extends JPanel{
checkWidth(); checkWidth();
} }
private void checkWidthAndHeightPane() {
if (widthAndHeightPane != null) {
widthAndHeightPane.setVisible(useHtml.isSelected());
}
}
public void populate(VanChartHtmlLabel htmlLabel) { public void populate(VanChartHtmlLabel htmlLabel) {
if (htmlLabel == null) { if (htmlLabel == null) {
return; return;
@ -186,6 +198,7 @@ public class VanChartHtmlLabelPane extends JPanel{
isCustomHeight.setSelected(htmlLabel.isCustomHeight()); isCustomHeight.setSelected(htmlLabel.isCustomHeight());
customHeight.setText(htmlLabel.getHeight()); customHeight.setText(htmlLabel.getHeight());
checkBoxUse(); checkBoxUse();
checkWidthAndHeightPane();
} }
public void update(VanChartHtmlLabel htmlLabel) { public void update(VanChartHtmlLabel htmlLabel) {

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java

@ -12,7 +12,7 @@ public class VanChartHtmlLabelPaneWithOutWidthAndHeight extends VanChartHtmlLabe
private static final long serialVersionUID = -9213286452724939880L; private static final long serialVersionUID = -9213286452724939880L;
protected JPanel createWidthAndHeightPane() { protected JPanel createWidthAndHeightPane() {
return new JPanel(); return null;
} }
protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) { protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) {

4
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -89,7 +89,7 @@ public class FormWidgetDetailPane extends FormDockView{
cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle());
} }
}; };
headGroup.setSelectedIndex(0); headGroup.setSelectedIndex(ONLINE_TAB);
this.add(headGroup, BorderLayout.NORTH); this.add(headGroup, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
@ -107,10 +107,10 @@ public class FormWidgetDetailPane extends FormDockView{
public void enterWidgetLib() { public void enterWidgetLib() {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB);
headGroup.setSelectedIndex(ONLINE_TAB);
ComponentReuseNotifyUtil.enterWidgetLibExtraAction(false); ComponentReuseNotifyUtil.enterWidgetLibExtraAction(false);
} }
/** /**
* 定位 * 定位
* *

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java

@ -145,7 +145,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel {
centerPane.remove(componentSelectPane); centerPane.remove(componentSelectPane);
componentSelectPane = createOnlineWidgetSelectPane(() -> { componentSelectPane = createOnlineWidgetSelectPane(() -> {
sharableWidgetProviders = new OnlineShareWidget[0]; sharableWidgetProviders = new OnlineShareWidget[0];
sharableWidgetProviders = ShareUtils.getFilterWidgets(filterStr); sharableWidgetProviders = getSharableWidgetArr(filterStr);
return sharableWidgetProviders; return sharableWidgetProviders;
}); });
centerPane.add(componentSelectPane, BorderLayout.CENTER); centerPane.add(componentSelectPane, BorderLayout.CENTER);
@ -155,6 +155,10 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel {
}); });
} }
protected OnlineShareWidget[] getSharableWidgetArr( String filterStr){
return ShareUtils.getFilterWidgets(filterStr);
}
public void initSearchTextFieldPaneListener(FlexSearchFieldPane searchFieldPane) { public void initSearchTextFieldPaneListener(FlexSearchFieldPane searchFieldPane) {
searchFieldPane.registerChangeListener(event -> { searchFieldPane.registerChangeListener(event -> {
Object object = event.getSource(); Object object = event.getSource();

8
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java

@ -2,9 +2,11 @@ package com.fr.design.mainframe.share.ui.online;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.sort.OnlineWidgetSortType;
import com.fr.design.mainframe.share.ui.base.FlexSearchFieldPane; import com.fr.design.mainframe.share.ui.base.FlexSearchFieldPane;
import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane;
import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.form.share.utils.ShareUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -106,6 +108,12 @@ public class OnlineWidgetShowPane extends AbstractOnlineWidgetShowPane {
}); });
} }
protected OnlineShareWidget[] getSharableWidgetArr( String filterStr){
OnlineShareWidget[] onlineShareWidgets = ShareUtils.getFilterWidgets(filterStr);
OnlineWidgetSortType.values()[lastSortTabSelectedIndex].sort(onlineShareWidgets);
return onlineShareWidgets;
}
@Override @Override
public void initSortTabPane(SortTabPane sortTabPane) { public void initSortTabPane(SortTabPane sortTabPane) {
super.initSortTabPane(sortTabPane); super.initSortTabPane(sortTabPane);

65
designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java

@ -1,15 +1,31 @@
package com.fr.design.mainframe.app; package com.fr.design.mainframe.app;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIExpandDialog;
import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.extra.exe.callback.ModifyStatusCallback;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.App; import com.fr.design.mainframe.App;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JWorkBook; 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.io.TemplateIOErrorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.context.PluginMarkerAdapter;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginControllerHelper;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.third.guava.collect.Multimap;
import com.fr.workspace.WorkContext;
import java.util.Collection;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
/** /**
@ -32,6 +48,7 @@ abstract class AbstractWorkBookApp implements App<WorkBook> {
@Override @Override
public OpenResult<WorkBook, Parameter[]> call() { public OpenResult<WorkBook, Parameter[]> call() {
WorkBook workBook = asIOFile(tplFile); WorkBook workBook = asIOFile(tplFile);
dealWithTemplateIOError(tplFile.getPath());
return new OpenResult<>(workBook, workBook.getParameters()); return new OpenResult<>(workBook, workBook.getParameters());
} }
}, emptyTemplate); }, emptyTemplate);
@ -51,6 +68,54 @@ abstract class AbstractWorkBookApp implements App<WorkBook> {
return emptyTemplate; return emptyTemplate;
} }
private void dealWithTemplateIOError(String path) {
// 试图获取多行读取错误提示并缓存待处理列表
String detail = TemplateIOErrorUtils.dealWithErrorDetailMultiLineAndCache(path);
if (detail.length() > 0) {
if (WorkContext.getCurrent().isLocal()) {
UIExpandDialog.Builder()
.owner(DesignerContext.getDesignerFrame())
.title(Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"))
.message(Toolkit.i18nText("Fine-Design_Template_Plugin_Error_Message_Local"))
.detail(detail)
.okText(Toolkit.i18nText("Fine-Design_Template_Plugin_Error_OK_Btn"))
.cancelText(Toolkit.i18nText("Fine-Design_Template_Plugin_Error_Cancel_Btn"))
.dialogActionListener(new DialogActionAdapter() {
public void doOk() {
installAndEnablePlugin(path);
}
@Override
public void doCancel() {
TemplateIOErrorUtils.invalidatePlugins(path);
}
}).build().setVisible(true);
} else {
UIExpandDialog.Builder().owner(DesignerContext.getDesignerFrame())
.title(Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"))
.message(Toolkit.i18nText("Fine-Design_Template_Plugin_Error_Message_Remote"))
.detail(detail)
.build()
.setVisible(true);
}
}
}
public void installAndEnablePlugin(String key) {
Multimap<String, PluginMarkerAdapter> stringPluginMarkerAdapterMultimap = TemplateIOErrorUtils.popPluginInfoMap(key);
Collection<PluginMarkerAdapter> disablePlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorUtils.DISABLE_PLUGIN);
for (PluginMarkerAdapter disablePlugin : disablePlugins) {
PluginManager.getController().enable(disablePlugin, new ModifyStatusCallback(false));
}
Collection<PluginMarkerAdapter> uninstallPlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorUtils.NOT_INSTALLED_PLUGIN);
for (PluginMarker uninstallPlugin : uninstallPlugins) {
PluginTask pluginTask = PluginTask.installTask(uninstallPlugin);
PluginControllerHelper.installOnline(uninstallPlugin, new InstallOnlineCallback(pluginTask));
}
}
@Override @Override
public String mark4Provider() { public String mark4Provider() {

Loading…
Cancel
Save