Browse Source

Merge branch 'feature/10.0' of ssh://code.fineres.com:7999/~tommy/design into feature/10.0

feature/10.0
kuangshuai 3 years ago
parent
commit
5c7946b0f6
  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. 20
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  4. 13
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  5. 2
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  6. 5
      designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java
  7. 2
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  8. 6
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  9. 51
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  10. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java
  11. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  12. 8
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  13. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java
  14. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java
  15. 85
      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";
JSExecutor DEFAULT = new JSExecutor() {
@Override
public void executor(String newValue) {
// do nothing
}
};
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 {
}
}

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

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.bridge.exec.JSExecutor;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit;
@ -17,17 +18,22 @@ import com.fr.plugin.manage.control.PluginTaskResult;
* Created by ibm on 2017/5/26.
*/
public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
protected JSCallback jsCallback;
protected JSCallback jsCallback = new JSCallback(JSExecutor.DEFAULT);
private static int HUNDRED_PERCENT = 100;
public InstallOnlineCallback(PluginTask pluginTask, JSCallback jsCallback){
public InstallOnlineCallback(PluginTask pluginTask) {
super(pluginTask);
}
public InstallOnlineCallback(PluginTask pluginTask, JSCallback jsCallback) {
super(pluginTask);
this.jsCallback = jsCallback;
}
@Override
public void updateProgress(String description, double aProgress) {
jsCallback.execute(String.valueOf(aProgress * HUNDRED_PERCENT + "%"));
jsCallback.execute(aProgress * HUNDRED_PERCENT + "%");
}
@ -37,10 +43,10 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
if (result.isSuccess()) {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success");
String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo;
String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo;
FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
} else if (result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall) {
int rv = FineJOptionPane.showConfirmDialog(
null,
Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"),
@ -51,8 +57,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
if (rv == FineJOptionPane.OK_OPTION) {
PluginMarker pluginMarker = result.getCurrentTask().getMarker();
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
}
else {
} else {
jsCallback.execute("success");
}
} else {
@ -63,5 +68,4 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
}
}

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

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

2
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -967,7 +967,7 @@ public class MutilTempalteTabPane extends JComponent {
//如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
FineJOptionPane.showMessageDialog(MutilTempalteTabPane.this, Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
MutilTempalteTabPane.this.repaint();
return;

5
designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java

@ -18,7 +18,7 @@ public class ComponentReuseNotifyUtil {
}
public static void enterWidgetLibExtraAction() {
public static void enterWidgetLibExtraAction(boolean needValidRead) {
if (ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib()) {
return;
}
@ -28,11 +28,12 @@ public class ComponentReuseNotifyUtil {
return COMPONENT_SNAP_CHAT_KEY;
}
});
if (snapChat.hasRead()) {
if (snapChat.hasRead() && needValidRead) {
DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Component_Reuse_Merge_Prompt"));
}
ComponentReuseNotificationInfo.getInstance().setClickedWidgetLib(true);
DesignerEnvManager.getEnvManager().saveXMLFile();
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -313,7 +313,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ComponentReuseNotifyUtil.enterWidgetLibExtraAction();
ComponentReuseNotifyUtil.enterWidgetLibExtraAction(true);
}
});
// 权限编辑

6
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -1465,10 +1465,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
editingFILE = fileChooser.getSelectedFILE();
}
// 在保存之前,初始化 templateID
if (StringUtils.isEmpty(this.template.getTemplateID())) {
generateTemplateId();
}
//收集和生成templateID 因为是另存为操作 无论怎么样都需要重新生成templateID
initForCollect();
FILE finalEditingFILE = editingFILE;
CallbackSaveWorker worker = new CallbackSaveWorker(new Callable<Boolean>() {

51
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.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
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.TableLayoutHelper;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.van.chart.designer.style.VanChartStylePane;
@ -32,7 +32,7 @@ import java.awt.event.ActionListener;
/**
* Created by Mitisky on 16/2/19.
*/
public class VanChartHtmlLabelPane extends JPanel{
public class VanChartHtmlLabelPane extends JPanel {
private static final long serialVersionUID = -5512128966013558611L;
private static final int JS_HEIGHT = 100;
@ -47,7 +47,9 @@ public class VanChartHtmlLabelPane extends JPanel{
private VanChartStylePane parent;
public void setCustomFormatterText(String text){
private JPanel widthAndHeightPane;
public void setCustomFormatterText(String text) {
contentTextArea.setText(text);
}
@ -56,24 +58,28 @@ public class VanChartHtmlLabelPane extends JPanel{
}
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);
JPanel widthAndHeightPane = createWidthAndHeightPane();
useHtml.addChangeListener(e -> checkWidthAndHeightPane());
widthAndHeightPane = createWidthAndHeightPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
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[]{useHtml},
new Component[]{widthAndHeightPane}
new Component[]{null, null},
};
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
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() {
@ -112,7 +118,7 @@ public class VanChartHtmlLabelPane extends JPanel{
ac.setTriggerKey(KeyStroke.getKeyStroke(shortCuts.replace("+", "pressed")));
ac.install(contentTextArea);
return new UIScrollPane(contentTextArea){
return new UIScrollPane(contentTextArea) {
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, JS_HEIGHT);
@ -121,15 +127,15 @@ public class VanChartHtmlLabelPane extends JPanel{
}
private void fireJSChange() {
if(parent != null){
if (parent != null) {
parent.attributeChanged();
}
}
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);
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);
isCustomWidth.addActionListener(new ActionListener() {
@ -147,13 +153,13 @@ public class VanChartHtmlLabelPane extends JPanel{
});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] columnSize = {p, f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
Component[][] components = new Component[][]{
new Component[]{isCustomWidth, customWidth},
new Component[]{isCustomHeight, customHeight},
new Component[] {null, null}
new Component[]{null, null}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
@ -171,8 +177,14 @@ public class VanChartHtmlLabelPane extends JPanel{
checkWidth();
}
public void populate(VanChartHtmlLabel htmlLabel){
if(htmlLabel == null){
private void checkWidthAndHeightPane() {
if (widthAndHeightPane != null) {
widthAndHeightPane.setVisible(useHtml.isSelected());
}
}
public void populate(VanChartHtmlLabel htmlLabel) {
if (htmlLabel == null) {
return;
}
setCustomFormatterText(htmlLabel.getCustomText());
@ -186,10 +198,11 @@ public class VanChartHtmlLabelPane extends JPanel{
isCustomHeight.setSelected(htmlLabel.isCustomHeight());
customHeight.setText(htmlLabel.getHeight());
checkBoxUse();
checkWidthAndHeightPane();
}
public void update(VanChartHtmlLabel htmlLabel) {
if(htmlLabel == null){
if (htmlLabel == null) {
return;
}
htmlLabel.setCustomText(contentTextArea.getText());

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;
protected JPanel createWidthAndHeightPane() {
return new JPanel();
return null;
}
protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) {

2
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -277,7 +277,7 @@ public class FormParaWidgetPane extends JPanel {
jPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jPanel.add(uiLabel, BorderLayout.NORTH);
jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Component_Reuse_Apply_Widget")), BorderLayout.CENTER);
jPanel.setToolTipText(Toolkit.i18nText("Fine-Design_Component_Reuse_Apply_Widget"));
jPanel.setToolTipText(Toolkit.i18nText("Fine-Design_Share_Component"));
return jPanel;
}

8
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());
}
};
headGroup.setSelectedIndex(0);
headGroup.setSelectedIndex(ONLINE_TAB);
this.add(headGroup, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
}
@ -105,12 +105,12 @@ public class FormWidgetDetailPane extends FormDockView{
}
public void enterWidgetLib() {
public void enterWidgetLib() {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB);
headGroup.setSelectedIndex(ONLINE_TAB);
ComponentReuseNotifyUtil.enterWidgetLibExtraAction();
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);
componentSelectPane = createOnlineWidgetSelectPane(() -> {
sharableWidgetProviders = new OnlineShareWidget[0];
sharableWidgetProviders = ShareUtils.getFilterWidgets(filterStr);
sharableWidgetProviders = getSharableWidgetArr(filterStr);
return sharableWidgetProviders;
});
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) {
searchFieldPane.registerChangeListener(event -> {
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.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.widgetfilter.FilterPane;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.form.share.utils.ShareUtils;
import com.fr.stable.StringUtils;
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
public void initSortTabPane(SortTabPane sortTabPane) {
super.initSortTabPane(sortTabPane);

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

@ -1,29 +1,45 @@
package com.fr.design.mainframe.app;
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.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.worker.open.OpenResult;
import com.fr.design.worker.open.OpenWorker;
import com.fr.file.FILE;
import com.fr.io.TemplateIOErrorUtils;
import com.fr.log.FineLoggerFactory;
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.third.guava.collect.Multimap;
import com.fr.workspace.WorkContext;
import java.util.Collection;
import java.util.concurrent.Callable;
/**
* Created by juhaoyu on 2018/6/27.
*/
abstract class AbstractWorkBookApp implements App<WorkBook> {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public JTemplate<WorkBook, ?> openTemplate(FILE tplFile) {
JWorkBook emptyTemplate = new JWorkBook(new WorkBook(new WorkSheet()), tplFile);
@ -32,6 +48,7 @@ abstract class AbstractWorkBookApp implements App<WorkBook> {
@Override
public OpenResult<WorkBook, Parameter[]> call() {
WorkBook workBook = asIOFile(tplFile);
dealWithTemplateIOError(tplFile.getPath());
return new OpenResult<>(workBook, workBook.getParameters());
}
}, emptyTemplate);
@ -50,20 +67,68 @@ abstract class AbstractWorkBookApp implements App<WorkBook> {
}
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
public String mark4Provider() {
return getClass().getName();
}
@Override
public void process() {
}
@Override
public void undo() {
}
}
Loading…
Cancel
Save