Browse Source

Merge pull request #6300 in DESIGN/design from release/11.0 to feature/x

* commit 'ced57339906156c4e3f3bdea38cbb170c662b4ec': (22 commits)
  REPORT-61276 决策报表-最新的release包,打开决策报表会打开一个空cpt;新建frm正常
  REPORT-61205 标准色视觉修改
  REPORT-61275 部分任务默认工具栏展开
  REPORT-61267 【FR11】【组件背景分离】组件复用-组件标题图案的“图案相对位置”切换不生效了,只有在重新上传图案的时候才生效;“位置”也不生效
  REPORT-61249 视觉图变动
  无JIRA任务 换一下svg图片,原来的svg图片有点变形
  REPORT-61237【固定布局-原布局推荐4.1】决策报表-自适应布局-新建空白模板,切换到固定布局,此时无法往设计画布里拖入组件
  REPORT-61055 【主题获取】主题导出插件几个小问题
  REPORT-60991 导出参数设置面板添加无响应
  REPORT-52578 10.0兼容新自适应插件的同步代码在11.0中需要改成异步的
  REPORT-61105 & REPORT-61096 & REPORT-61012 控件联动及兼容老模板调整
  REPORT-61177 解决引导页弹窗展示变成半透明的问题
  REPORT-61207 行间距减小,放在window上文字截断
  REPORT-61219 【主题获取】右键有主题的组件,鼠标从获取主题滑到详细说明,两个都被选中了
  REPORT-60942 加载图视觉更新
  REPORT-61125 交互优化更新
  REPORT-60993 导出-导出事件-事件内容没有初始化
  REPORT-58796
  REPORT-60982 主题获取-点击获取主题后网络较慢时过渡不合理
  REPORT-58796
  ...
feature/x
superman 3 years ago
parent
commit
b7942f0fdb
  1. 18
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  2. 40
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  5. 19
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java
  6. 98
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingPane.java
  7. 8
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
  8. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ImagePanel.java
  9. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  10. 20
      designer-base/src/main/java/com/fr/design/style/color/ColorFactory.java
  11. BIN
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.png
  12. 13
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.svg
  13. BIN
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.png
  14. 13
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.svg
  15. BIN
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.png
  16. 23
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.svg
  17. 3
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java
  18. 27
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  19. 31
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  20. 54
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java
  21. 37
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
  22. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  23. 11
      designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
  24. BIN
      designer-form/src/main/resources/com/fr/design/form/images/loading.gif
  25. 24
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/5-7/2.frm
  26. 57
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/4.frm
  27. 9
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  28. 21
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  29. 24
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  30. 37
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  31. 45
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  32. 13
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java
  33. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java
  34. 51
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java

18
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -3,6 +3,8 @@ package com.fr.design.gui.ibutton;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -24,7 +26,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver { public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver, UIObserver {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int TEXT_LENGTH = 3; private static final int TEXT_LENGTH = 3;
private static final int BUTTON_SIZE = 2; private static final int BUTTON_SIZE = 2;
@ -37,6 +39,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private boolean isToolBarComponent = false; private boolean isToolBarComponent = false;
private boolean isClick; private boolean isClick;
private UIObserverListener uiObserverListener;
private boolean autoFireStateChanged = true; private boolean autoFireStateChanged = true;
public UIButtonGroup(String[] textArray) { public UIButtonGroup(String[] textArray) {
@ -326,6 +329,9 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
((ChangeListener) listeners[i + 1]).stateChanged(e); ((ChangeListener) listeners[i + 1]).stateChanged(e);
} }
} }
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
} }
/** /**
@ -368,6 +374,16 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return true; return true;
} }
@Override
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
/** /**
* @param l * @param l

40
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -218,6 +218,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
this.add(editorPane, BorderLayout.CENTER); this.add(editorPane, BorderLayout.CENTER);
} }
public void reset() {
editorPane.populate(new SingleJavaScript[0]);
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting"); return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting");
@ -399,6 +403,8 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private static final long serialVersionUID = -6564079764032351372L; private static final long serialVersionUID = -6564079764032351372L;
private UIComboBox exportTypeComboBox;
public ExportTypeCombobox() { public ExportTypeCombobox() {
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE} exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE}
, EXPORT_TYPES_MAP); , EXPORT_TYPES_MAP);
@ -449,6 +455,24 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public FileNameCombobox() { public FileNameCombobox() {
fileNameComboBox = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, FILENAME_TYPE_MAP); fileNameComboBox = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, FILENAME_TYPE_MAP);
fileNameComboBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final int row = table.getSelectedRow();
if (row == -1) {
return;
}
SingleJavaScript js = getList().get(row);
Object ob = fileNameComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setDefaultFileName(StringUtils.equals(value, DEFAULT));
if (js.isDefaultFileName()) {
js.setFileName(StringUtils.EMPTY);
}
}
table.repaint();
}
});
this.addCellEditorListener(new CellEditorListener() { this.addCellEditorListener(new CellEditorListener() {
@Override @Override
@ -458,15 +482,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
Object ob = fileNameComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setDefaultFileName(StringUtils.equals(value, DEFAULT));
}
fireTableDataChanged(); fireTableDataChanged();
} }
}); });
@ -514,7 +529,11 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value != null) {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(value));
} else {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build()); fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build());
}
return fileNameFormulaEditor; return fileNameFormulaEditor;
} }
@ -633,7 +652,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
} }
ParameterProvider[] providers = (ParameterProvider[]) value; ParameterProvider[] providers = (ParameterProvider[]) value;
if (providers != null) { if (providers != null) {
paraSettingPane.refresh(Arrays.asList(providers)); paraSettingPane.refresh(new ArrayList<>(Arrays.asList(providers)));
} }
return paraButton; return paraButton;
} }
@ -758,6 +777,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public void populateBean(ExportJavaScript ob) { public void populateBean(ExportJavaScript ob) {
if (ob == null) { if (ob == null) {
ob = new ExportJavaScript(); ob = new ExportJavaScript();
otherTemplatePane.reset();
} }
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1); this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1);
if (ob.isCurrentTemplate()) { if (ob.isCurrentTemplate()) {

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

@ -40,7 +40,6 @@ public class GuideView extends JDialog {
this.setSize(window.getSize()); this.setSize(window.getSize());
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
setBg(); setBg();
this.setGlassPane(new GuideLoadingGlassPane());
DesignerContext.getDesignerFrame().addWindowListener(new WindowAdapter() { DesignerContext.getDesignerFrame().addWindowListener(new WindowAdapter() {
@Override @Override
@ -106,12 +105,16 @@ public class GuideView extends JDialog {
} }
public void showLoading() { public void showLoading() {
this.setGlassPane(GuideLoadingGlassPane.getInstance());
GuideLoadingGlassPane.getInstance().startLoading();
updateGuideViewLocation(); updateGuideViewLocation();
this.setVisible(true); this.setVisible(true);
this.invalidate();
this.getGlassPane().setVisible(true); this.getGlassPane().setVisible(true);
} }
public void hideLoading() { public void hideLoading() {
GuideLoadingGlassPane.getInstance().stopLoading();
this.getGlassPane().setVisible(false); this.getGlassPane().setVisible(false);
repaint(); repaint();
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {

2
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java

@ -78,7 +78,7 @@ public class GuideCompleteDialog extends JDialog {
title.setForeground(FONT_COLOR); title.setForeground(FONT_COLOR);
textArea = new UITextPane(); textArea = new UITextPane();
changeLineSpacing(textArea, 0.19f,false); changeLineSpacing(textArea, 0.15f,false);
textArea.setEnabled(false); textArea.setEnabled(false);
textArea.setOpaque(false); textArea.setOpaque(false);
textArea.setFont(CONTENT_FONT); textArea.setFont(CONTENT_FONT);

19
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java

@ -9,11 +9,11 @@ import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
public class GuideLoadingGlassPane extends JPanel { public class GuideLoadingGlassPane extends JPanel {
private static final String loadingImagePath = "/com/fr/design/mainframe/guide/loading.gif";
private static GuideLoadingGlassPane loadingPane; private static GuideLoadingGlassPane loadingPane;
public static GuideLoadingGlassPane getInstance() { public static GuideLoadingGlassPane getInstance() {
@ -32,16 +32,15 @@ public class GuideLoadingGlassPane extends JPanel {
public void initComponent() { public void initComponent() {
JPanel loadingView = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel loadingView = FRGUIPaneFactory.createBorderLayout_S_Pane();
loadingView.setOpaque(false); loadingView.setOpaque(false);
loadingView.setPreferredSize(new Dimension(130, 120)); loadingView.setPreferredSize(new Dimension(150, 90));
JPanel imageContainer = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); JPanel imageContainer = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
imageContainer.setOpaque(false); imageContainer.setOpaque(false);
ImagePanel imagePanel = new ImagePanel(loadingImagePath);
imagePanel.setOpaque(false); imageContainer.add(GuideLoadingPane.getInstance());
imagePanel.setPreferredSize(new Dimension(84, 84));
imageContainer.add(imagePanel);
UILabel hintLabel = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Loading_Wait")); UILabel hintLabel = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Loading_Wait"));
hintLabel.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));
hintLabel.setHorizontalAlignment(SwingConstants.CENTER); hintLabel.setHorizontalAlignment(SwingConstants.CENTER);
hintLabel.setForeground(Color.WHITE); hintLabel.setForeground(Color.WHITE);
@ -50,4 +49,12 @@ public class GuideLoadingGlassPane extends JPanel {
this.add(loadingView, new GridBagConstraints()); this.add(loadingView, new GridBagConstraints());
} }
public void startLoading() {
GuideLoadingPane.getInstance().start();
}
public void stopLoading() {
GuideLoadingPane.getInstance().stop();
}
} }

98
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingPane.java

@ -0,0 +1,98 @@
package com.fr.design.mainframe.guide.ui;
import javax.swing.JPanel;
import javax.swing.Timer;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by kerry on 2020-10-23
*/
public class GuideLoadingPane extends JPanel {
private static final BasicStroke STROKE = new BasicStroke(4);
private static final int FPS = 30;
private static final int START_ANGLE = 90;
private static GuideLoadingPane imagePanel;
private Image image;
private int angle;
private Timer timer;
public static GuideLoadingPane getInstance() {
if (imagePanel == null) {
imagePanel = new GuideLoadingPane();
}
return imagePanel;
}
public GuideLoadingPane() {
this.setOpaque(false);
this.setPreferredSize(new Dimension(50, 50));
timer = new Timer(1000 / FPS, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
repaint();
angle -= 180 / FPS; // 5 degrees per 100 ms = 50 degrees/second
if (angle > -270) {
angle += 2 * 360;
}
}
});
}
public void start() {
angle = START_ANGLE;
timer.start();
}
public void stop() {
timer.stop();
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Composite oldComposite = g2.getComposite();
Stroke oldStroke = g2.getStroke();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
int d = Math.min(getWidth(), getHeight());
int r = d / 2;
Point circlePoint = new Point(getWidth() / 2, getHeight() / 2);
g2.setColor(Color.WHITE);
g2.fillOval(circlePoint.x - r, circlePoint.y - r, d, d);
g2.setColor(Color.BLACK);
int waitCircleD = d / 10;
int waitCircleR = waitCircleD / 2;
g2.fillOval(circlePoint.x - r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD);
g2.fillOval(circlePoint.x - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD);
g2.fillOval(circlePoint.x + r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD);
g2.setStroke(STROKE);
g2.setColor(Color.decode("#419BF9"));
int lineWidth = (int) STROKE.getLineWidth();
g2.drawArc(circlePoint.x - r + lineWidth / 2 , circlePoint.y - r + lineWidth / 2, d - lineWidth, d - lineWidth, angle, -90);
g2.setStroke(oldStroke);
g2.setComposite(oldComposite);
}
}

8
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.guide.ui; package com.fr.design.mainframe.guide.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -14,7 +15,6 @@ import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.base.GuideVersion; import com.fr.design.mainframe.guide.base.GuideVersion;
import com.fr.design.mainframe.guide.collect.GuideCollector; import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -31,9 +31,9 @@ import java.awt.event.ActionListener;
public class GuideManageDialog extends JDialog { public class GuideManageDialog extends JDialog {
private static final int DEFAULT_HEIGHT = 400; private static final int DEFAULT_HEIGHT = 400;
private static final int DEFAULT_WIDTH = 600; private static final int DEFAULT_WIDTH = 600;
private static final Icon GROUP_COMPLETE_NONE = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_none.png"); private static final Icon GROUP_COMPLETE_NONE = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_none.svg");
private static final Icon GROUP_COMPLETE_SOME = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_some.png"); private static final Icon GROUP_COMPLETE_SOME = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_some.svg");
private static final Icon GROUP_COMPLETE_ALL = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_all.png"); private static final Icon GROUP_COMPLETE_ALL = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_all.svg");
private static final Color BORDER_COLOR = new Color(224, 224, 225); private static final Color BORDER_COLOR = new Color(224, 224, 225);
private static final Color UNCOMPLETE_FONT_COLOR = new Color(51, 51, 52); private static final Color UNCOMPLETE_FONT_COLOR = new Color(51, 51, 52);
private static final Color COMPLETE_FONT_COLOR = new Color(51,51,52,128); private static final Color COMPLETE_FONT_COLOR = new Color(51,51,52,128);

28
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ImagePanel.java

@ -1,28 +0,0 @@
package com.fr.design.mainframe.guide.ui;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
/**
* Created by kerry on 2020-10-23
*/
public class ImagePanel extends JPanel {
private Image image;
public ImagePanel(String imagePath) {
image = Toolkit.getDefaultToolkit().createImage(ImagePanel.class
.getResource(imagePath));
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (image != null) {
g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
}
}
}

12
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -141,6 +141,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
if (saveAsButton != null) { if (saveAsButton != null) {
saveAsButton.setEnabled(StringUtils.isNotEmpty(name)); saveAsButton.setEnabled(StringUtils.isNotEmpty(name));
} }
actionListener.onInitialize(theme);
isPopulating = false; isPopulating = false;
} }
@ -218,6 +219,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
super.afterCommit(); super.afterCommit();
saveButton.setEnabled(false); saveButton.setEnabled(false);
saveAsButton.setEnabled(true); saveAsButton.setEnabled(true);
actionListener.onSaved(config.cachedFetch(getName()));
DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_Successfully")); DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_Successfully"));
} }
}); });
@ -342,11 +344,21 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
} }
public interface TemplateThemeProfileActionListener { public interface TemplateThemeProfileActionListener {
void onInitialize(TemplateTheme theme);
void onThemeNameChecked(String name, boolean valid); void onThemeNameChecked(String name, boolean valid);
void onSaved(TemplateTheme theme);
} }
public static class TemplateThemeProfileActionAdapter implements TemplateThemeProfileActionListener { public static class TemplateThemeProfileActionAdapter implements TemplateThemeProfileActionListener {
@Override
public void onInitialize(TemplateTheme theme) {}
@Override @Override
public void onThemeNameChecked(String name, boolean valid) { } public void onThemeNameChecked(String name, boolean valid) { }
@Override
public void onSaved(TemplateTheme theme) {}
} }
} }

20
designer-base/src/main/java/com/fr/design/style/color/ColorFactory.java

@ -72,16 +72,16 @@ public interface ColorFactory {
}; };
public static final Color STANDARD_COLORS[] = { public static final Color STANDARD_COLORS[] = {
new Color(166, 89, 66), new Color(234, 68, 49),
new Color(166, 123, 66), new Color(179, 96, 36),
new Color(166, 66, 66), new Color(232, 147, 37),
new Color(103, 166, 66), new Color(109, 214, 50),
new Color(66, 121, 166), new Color(51, 147, 219),
new Color(68, 66, 166), new Color(56, 54, 179),
new Color(98, 66, 166), new Color(93, 54, 179),
new Color(146, 66, 166), new Color(154, 54, 179),
new Color(75, 18, 89), new Color(127, 76, 217),
new Color(89, 18, 51) new Color(179, 36, 102)
}; };

BIN
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 B

13
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.svg

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>全部完成</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="规范" transform="translate(-82.000000, -660.000000)">
<g id="icon_QuestionIcon_normal备份-9" transform="translate(82.000000, 660.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<path d="M8,0 C12.4178824,0 16,3.58211765 16,8 C16,12.4178824 12.4178824,16 8,16 C3.58211765,16 0,12.4178824 0,8 C0,3.58211765 3.58211765,0 8,0 Z M8,0.5 C3.85826002,0.5 0.5,3.85826002 0.5,8 C0.5,12.14174 3.85826002,15.5 8,15.5 C12.14174,15.5 15.5,12.14174 15.5,8 C15.5,3.85826002 12.14174,0.5 8,0.5 Z" id="Fill-3" fill="#9FCCFB" fill-rule="nonzero"></path>
<path d="M8,1 C11.8656471,1 15,4.13435294 15,8 C15,11.8656471 11.8656471,15 8,15 C4.13435294,15 1,11.8656471 1,8 C1,4.13435294 4.13435294,1 8,1 Z M11.1613691,5.19061128 L6.93333556,9.72064718 L5.03863539,7.69061128 C4.81253501,7.44836087 4.43286168,7.43526869 4.19061128,7.66136907 C3.94836087,7.88746945 3.93526869,8.26714277 4.16136907,8.50939318 L6.4947024,11.0093932 C6.73190478,11.2635386 7.13476635,11.2635386 7.37196872,11.0093932 L12.0386354,6.00939318 C12.2647358,5.76714277 12.2516436,5.38746945 12.0093932,5.16136907 C11.7671428,4.93526869 11.3874694,4.94836087 11.1613691,5.19061128 Z" id="形状结合" fill="#419BF9"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

13
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.svg

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>未完成@2x</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="规范" transform="translate(-223.000000, -660.000000)">
<g id="icon_QuestionIcon_normal备份-9" transform="translate(223.000000, 660.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<path d="M8,0 C12.4178824,0 16,3.58211765 16,8 C16,12.4178824 12.4178824,16 8,16 C3.58211765,16 0,12.4178824 0,8 C0,3.58211765 3.58211765,0 8,0 Z M8,0.5 C3.85826002,0.5 0.5,3.85826002 0.5,8 C0.5,12.14174 3.85826002,15.5 8,15.5 C12.14174,15.5 15.5,12.14174 15.5,8 C15.5,3.85826002 12.14174,0.5 8,0.5 Z" id="Fill-3" fill-opacity="0.338693045" fill="#419BF9" fill-rule="nonzero"></path>
<path d="M8,1 C11.8656471,1 15,4.13435294 15,8 C15,11.8656471 11.8656471,15 8,15 C4.13435294,15 1,11.8656471 1,8 C1,4.13435294 4.13435294,1 8,1 Z M8,2 C4.68663769,2 2,4.68663769 2,8 C2,11.3133623 4.68663769,14 8,14 C11.3133623,14 14,11.3133623 14,8 C14,4.68663769 11.3133623,2 8,2 Z" id="Fill-3" fill="#419BF9" fill-rule="nonzero"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

23
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.svg

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>部分完成</title>
<defs>
<path d="M14,7 C14,10.8656471 10.8656471,14 7,14 C3.13435294,14 0,10.8656471 0,7 C0,3.13435294 3.13435294,0 7,0 C10.8656471,0 14,3.13435294 14,7 Z" id="path-1"></path>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="规范" transform="translate(-155.000000, -660.000000)">
<g id="icon_QuestionIcon_normal备份-9" transform="translate(155.000000, 660.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<path d="M8,0 C12.4178824,0 16,3.58211765 16,8 C16,12.4178824 12.4178824,16 8,16 C3.58211765,16 0,12.4178824 0,8 C0,3.58211765 3.58211765,0 8,0 Z M8,0.5 C3.85826002,0.5 0.5,3.85826002 0.5,8 C0.5,12.14174 3.85826002,15.5 8,15.5 C12.14174,15.5 15.5,12.14174 15.5,8 C15.5,3.85826002 12.14174,0.5 8,0.5 Z" id="Fill-3" fill="#BFDDFD" fill-rule="nonzero"></path>
<g id="路径-3" transform="translate(1.000000, 1.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="蒙版"></g>
<path d="M0.652488577,7.36430983 C7.24039717,3.20105356 7.90994979,10.1117332 13.9699833,7.81918587 C18.0100056,6.29082097 18.0100056,7.06390999 13.9699833,10.1384529 L11.1005083,14 L2.36825002,13.4206497 L-0.640871294,7.81918587 C-4.17057044,10.2914394 -3.73945048,10.139814 0.652488577,7.36430983 Z" id="路径-4" fill="#419BF9" mask="url(#mask-2)"></path>
<path d="M7,0 C10.8656471,0 14,3.13435294 14,7 C14,10.8656471 10.8656471,14 7,14 C3.13435294,14 0,10.8656471 0,7 C0,3.13435294 3.13435294,0 7,0 Z M7,1 C3.68663769,1 1,3.68663769 1,7 C1,10.3133623 3.68663769,13 7,13 C10.3133623,13 13,10.3133623 13,7 C13,3.68663769 10.3133623,1 7,1 Z" id="蒙版" fill="#419BF9" fill-rule="nonzero" mask="url(#mask-2)"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

3
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java

@ -110,7 +110,8 @@ public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
@Override @Override
public boolean accept(XCreator creator, int x, int y) { public boolean accept(XCreator creator, int x, int y) {
return true; Component component = container.getComponentAt(x, y);
return component != container;
} }

27
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -81,6 +81,9 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE;
* 创建组件事件 * 创建组件事件
*/ */
public class CreateComponentAction extends UpdateAction { public class CreateComponentAction extends UpdateAction {
private static final double MAX_WIDTH = 960.0;
private static final double MAX_HEIGHT = 540.0;
ShareUIAspect aspect; ShareUIAspect aspect;
/** /**
* 等待时间 500 ms. * 等待时间 500 ms.
@ -114,8 +117,12 @@ public class CreateComponentAction extends UpdateAction {
// 获取选中的组件 // 获取选中的组件
Triple<Widget, XCreator, Rectangle> sharedTriple = ComponentTransformerFactory.getInstance().transform(selection); Triple<Widget, XCreator, Rectangle> sharedTriple = ComponentTransformerFactory.getInstance().transform(selection);
if (sharedTriple == null) { if (sharedTriple == null) {
FineJOptionPane.showMessageDialog(designerFrame, Toolkit.i18nText("Fine-Design_Share_Select_Error_Tip"), showErrMsgDialog(Toolkit.i18nText("Fine-Design_Share_Select_Error_Tip"));
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), ERROR_MESSAGE, IOUtils.readIcon("/com/fr/base/images/share/Information_Icon_warning_normal_32x32.png")); return;
}
if (isBeyondMaxSize(sharedTriple.getRight())) {
showErrMsgDialog(Toolkit.i18nText("Fine-Design_Share_Widget_Size_Error_Tip"));
return; return;
} }
@ -398,4 +405,20 @@ public class CreateComponentAction extends UpdateAction {
} }
return paras; return paras;
} }
private boolean isBeyondMaxSize(Rectangle rec) {
double width = rec.getWidth();
double height = rec.getHeight();
return width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT);
}
private void showErrMsgDialog(String err) {
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
err,
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE,
IOUtils.readIcon("/com/fr/base/images/share/Information_Icon_warning_normal_32x32.png")
);
}
} }

31
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java

@ -10,6 +10,7 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI; import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource; import com.fr.design.login.DesignerLoginSource;
@ -39,22 +40,35 @@ import java.util.concurrent.ExecutionException;
*/ */
public class DownloadSuitableThemeAction extends UpdateAction { public class DownloadSuitableThemeAction extends UpdateAction {
private final String themePath; private final String themePath;
private final UIPopupMenu popupMenu;
private boolean downloading = false; private boolean downloading = false;
private JTemplate<?, ?> currentTemplate; private JTemplate<?, ?> currentTemplate;
public DownloadSuitableThemeAction(String themePath) { public DownloadSuitableThemeAction(String themePath, UIPopupMenu popupMenu) {
this.themePath = themePath; this.themePath = themePath;
this.popupMenu = popupMenu;
this.putValue(Action.SMALL_ICON, null); this.putValue(Action.SMALL_ICON, null);
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme")); this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme"));
} }
@Override @Override
public UIMenuItem createMenuItem() { public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem(); return getLoadingMenuItem();
menuItem.setOpaque(true); }
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI()); public LoadingMenuItem getLoadingMenuItem() {
return menuItem; Object object = this.getValue(LoadingMenuItem.class.getName());
if (object == null) {
UIMenuItem menuItem = new LoadingMenuItem(this);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(LoadingMenuItem.class.getName(), object);
}
return (LoadingMenuItem) object;
} }
@Override @Override
@ -91,6 +105,8 @@ public class DownloadSuitableThemeAction extends UpdateAction {
} }
downloading = true; downloading = true;
LoadingMenuItem menuItem = getLoadingMenuItem();
menuItem.startLoading();
new SwingWorker<FormTheme, Void>() { new SwingWorker<FormTheme, Void>() {
@Override @Override
@ -109,11 +125,14 @@ public class DownloadSuitableThemeAction extends UpdateAction {
onThemeFetched(theme); onThemeFetched(theme);
downloading = false; downloading = false;
LoadingMenuItem menuItem = getLoadingMenuItem();
menuItem.stopLoading();
} }
}.execute(); }.execute();
} }
public void onThemeFetched(FormTheme theme) { public void onThemeFetched(FormTheme theme) {
popupMenu.menuSelectionChanged(false);
if (theme == null) { if (theme == null) {
return; return;
} }

54
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java

@ -0,0 +1,54 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.general.IOUtils;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import java.awt.Graphics;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/10/19
*/
public class LoadingMenuItem extends UIMenuItem {
private boolean loading = false;
private final Icon profileIcon = IOUtils.readIcon("/com/fr/design/form/images/loading.gif");
public LoadingMenuItem(Action action) {
super(action);
setOpaque(true);
setBackground(ColorConstants.BACKGROUND);
setUI(new SharedComponentActionMenuItemUI());
}
public void startLoading() {
loading = true;
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
revalidate();
repaint();
}
public void stopLoading() {
loading = false;
setBorder(BorderFactory.createEmptyBorder());
revalidate();
repaint();
}
public boolean isLoading() {
return loading;
}
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
if (loading) {
profileIcon.paintIcon(this, g, getWidth() - 20, 0);
}
}
}

37
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java

@ -2,14 +2,18 @@ package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.imenu.UIMenuItemUI; import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.ButtonModel; import javax.swing.ButtonModel;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.JPopupMenu; import javax.swing.MenuSelectionManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@ -27,7 +31,7 @@ public class SharedComponentActionMenuItemUI extends UIMenuItemUI {
int menuWidth = menuItem.getWidth(); int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight(); int menuHeight = menuItem.getHeight();
g.setColor(UIConstants.NORMAL_BACKGROUND); g.setColor(ColorConstants.BACKGROUND);
g.fillRect(0, 0, menuWidth, menuHeight); g.fillRect(0, 0, menuWidth, menuHeight);
if (menuItem.isOpaque()) { if (menuItem.isOpaque()) {
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
@ -36,9 +40,36 @@ public class SharedComponentActionMenuItemUI extends UIMenuItemUI {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7); GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
} }
g.setColor(oldColor); g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { } else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor); g.setColor(oldColor);
} }
} }
@Override
protected void doClick(MenuSelectionManager msm) {
if (hasLoadingMenuItem()) {
return;
}
if (menuItem instanceof LoadingMenuItem) {
menuItem.doClick(0);
} else {
super.doClick(msm);
}
}
private boolean hasLoadingMenuItem() {
Container parent = menuItem.getParent();
if (parent instanceof UIPopupMenu) {
Component[] components = parent.getComponents();
for (Component component: components) {
if (component instanceof LoadingMenuItem && ((LoadingMenuItem) component).isLoading()) {
return true;
}
}
}
return false;
}
} }

3
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -116,12 +116,13 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public JPopupMenu createRightClickPopupMenu() { public JPopupMenu createRightClickPopupMenu() {
UIPopupMenu popupMenu = new UIPopupMenu(); UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true); popupMenu.setOnlyText(true);
popupMenu.setOpaque(true);
popupMenu.setBackground(ColorConstants.BACKGROUND); popupMenu.setBackground(ColorConstants.BACKGROUND);
OnlineShareWidget widget = getWidget(); OnlineShareWidget widget = getWidget();
String suitableThemeFile = widget.getThemePath(); String suitableThemeFile = widget.getThemePath();
if (StringUtils.isNotEmpty(suitableThemeFile)) { if (StringUtils.isNotEmpty(suitableThemeFile)) {
popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile).createMenuItem()); popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile, popupMenu).createMenuItem());
} }
popupMenu.add(new Jump2DetailAction(getWidget().getId()).createMenuItem()); popupMenu.add(new Jump2DetailAction(getWidget().getId()).createMenuItem());

11
designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java

@ -282,7 +282,7 @@ public class NewFormPane extends BasicPane {
private void newForm(String path) { private void newForm(String path) {
BaseJForm jForm; BaseJForm jForm;
try { try {
Form form = initEmptyBodyForm(); Form form = Form.getEmptyBodyForm();
initLayoutInfo(form, path); initLayoutInfo(form, path);
jForm = StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, new Object[]{form}, BaseJForm.class); jForm = StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, new Object[]{form}, BaseJForm.class);
DesignerContext.getDesignerFrame().addAndActivateJTemplate((JTemplate<?, ?>) jForm); DesignerContext.getDesignerFrame().addAndActivateJTemplate((JTemplate<?, ?>) jForm);
@ -291,15 +291,6 @@ public class NewFormPane extends BasicPane {
} }
} }
private Form initEmptyBodyForm() {
WFitLayout body = new WFitLayout("body");
body.setContainerWidth(WBorderLayout.DEFAULT_WIDTH);
body.setContainerHeight(WBorderLayout.DEFAULT_HEIGHT);
WBorderLayout borderLayout = new WBorderLayout("form");
borderLayout.addCenter(body);
return new Form(borderLayout);
}
/** /**
* 通过布局文件的位置初始化Form对象的布局信息 * 通过布局文件的位置初始化Form对象的布局信息
* *

BIN
designer-form/src/main/resources/com/fr/design/form/images/loading.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

24
designer-form/src/main/resources/com/fr/design/form/layouts/templates/5-7/2.frm

@ -59,50 +59,50 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box1"/> <WidgetName name="box5"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="0" y="75" width="716" height="274"/> <BoundsAttr x="0" y="303" width="244" height="237"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box2"/> <WidgetName name="box4"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="716" y="75" width="244" height="465"/> <BoundsAttr x="244" y="303" width="236" height="237"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box0"/> <WidgetName name="box3"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="0" y="0" width="960" height="75"/> <BoundsAttr x="480" y="303" width="236" height="237"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box5"/> <WidgetName name="box2"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="0" y="349" width="244" height="191"/> <BoundsAttr x="716" y="75" width="244" height="465"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box4"/> <WidgetName name="box1"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="244" y="349" width="236" height="191"/> <BoundsAttr x="0" y="75" width="716" height="228"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box3"/> <WidgetName name="box0"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="480" y="349" width="236" height="191"/> <BoundsAttr x="0" y="0" width="960" height="75"/>
</Widget> </Widget>
<ShowBookmarks showBookmarks="true"/> <ShowBookmarks showBookmarks="true"/>
<Sorted sorted="false"/> <Sorted sorted="false"/>

57
designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/4.frm

@ -59,96 +59,105 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box4"/> <WidgetName name="box10"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="246" y="142" width="468" height="398"/> <BoundsAttr x="714" y="379" width="246" height="161"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box0"/> <WidgetName name="box9"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="0" y="0" width="960" height="75"/> <BoundsAttr x="714" y="227" width="246" height="152"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box9"/> <WidgetName name="box8"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="714" y="379" width="246" height="161"/> <BoundsAttr x="714" y="75" width="246" height="152"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box3"/> <WidgetName name="box7"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="0" y="379" width="246" height="161"/> <BoundsAttr x="480" y="75" width="234" height="67"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box8"/> <WidgetName name="box6"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="714" y="227" width="246" height="152"/> <BoundsAttr x="246" y="75" width="234" height="67"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box7"/> <WidgetName name="box5"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="714" y="75" width="246" height="152"/> <BoundsAttr x="246" y="142" width="468" height="237"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box2"/> <WidgetName name="box4"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="0" y="227" width="246" height="152"/> <BoundsAttr x="246" y="379" width="468" height="161"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box1"/> <WidgetName name="box3"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="0" y="75" width="246" height="152"/> <BoundsAttr x="0" y="379" width="246" height="161"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box6"/> <WidgetName name="box2"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="480" y="75" width="234" height="67"/> <BoundsAttr x="0" y="227" width="246" height="152"/>
</Widget> </Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget"> <Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout"> <InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout> <OccupiedLayout>
<WidgetName name="box5"/> <WidgetName name="box1"/>
</OccupiedLayout> </OccupiedLayout>
</InnerWidget> </InnerWidget>
<BoundsAttr x="246" y="75" width="234" height="67"/> <BoundsAttr x="0" y="75" width="246" height="152"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box0"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="0" y="0" width="960" height="75"/>
</Widget> </Widget>
<ShowBookmarks showBookmarks="true"/> <ShowBookmarks showBookmarks="true"/>
<Sorted sorted="false"/> <Sorted sorted="false"/>
<MobileWidgetList> <MobileWidgetList>
<Widget widgetName="box0"/> <Widget widgetName="box0"/>
<Widget widgetName="box1"/> <Widget widgetName="box1"/>
<Widget widgetName="box5"/>
<Widget widgetName="box6"/> <Widget widgetName="box6"/>
<Widget widgetName="box7"/> <Widget widgetName="box7"/>
<Widget widgetName="box4"/>
<Widget widgetName="box2"/>
<Widget widgetName="box8"/> <Widget widgetName="box8"/>
<Widget widgetName="box3"/> <Widget widgetName="box5"/>
<Widget widgetName="box2"/>
<Widget widgetName="box9"/> <Widget widgetName="box9"/>
<Widget widgetName="box3"/>
<Widget widgetName="box4"/>
<Widget widgetName="box10"/>
</MobileWidgetList> </MobileWidgetList>
<FrozenWidgets/> <FrozenWidgets/>
<MobileBookMarkStyle class="com.fr.form.ui.mobile.impl.DefaultMobileBookMarkStyle"/> <MobileBookMarkStyle class="com.fr.form.ui.mobile.impl.DefaultMobileBookMarkStyle"/>

9
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -4,6 +4,7 @@ import com.fr.base.Parameter;
import com.fr.base.chart.exception.ChartNotFoundException; import com.fr.base.chart.exception.ChartNotFoundException;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.fit.NewJForm;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.BaseJForm;
@ -19,6 +20,7 @@ import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.util.ReadXmlType; import com.fr.report.util.ReadXmlType;
@ -58,9 +60,8 @@ class FormApp extends AbstractAppProvider {
* @return * @return
*/ */
private JTemplate<Form, ?> compatibleForm(FILE tplFile, HashMap<String, Class> classType) { private JTemplate<Form, ?> compatibleForm(FILE tplFile, HashMap<String, Class> classType) {
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG), JForm.class)) {
classType.put(Constants.ARG_2, Parameter[].class); classType.put(Constants.ARG_2, Parameter[].class);
JForm emptyForm = new JForm(new Form(new WBorderLayout("form")), tplFile); NewJForm emptyForm = new NewJForm(Form.getEmptyBodyForm(), tplFile);
OpenWorker<OpenResult<Form, Parameter[]>> worker = new OpenWorker<>( OpenWorker<OpenResult<Form, Parameter[]>> worker = new OpenWorker<>(
new Callable<OpenResult<Form, Parameter[]>>() { new Callable<OpenResult<Form, Parameter[]>>() {
@Override @Override
@ -84,10 +85,6 @@ class FormApp extends AbstractAppProvider {
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class);
} }
return emptyForm; return emptyForm;
} else {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{getForm(tplFile), tplFile}, classType, BaseJForm.class);
}
} }
@Nullable @Nullable

21
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

@ -31,6 +31,7 @@ import javax.swing.JComponent;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JRootPane; import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -231,7 +232,7 @@ public class GuideCreateUtils {
int returnVal = FineJOptionPane.showConfirmDialog( int returnVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Guide_Option_Confirm_Not_Login"), Toolkit.i18nText("Fine-Design_Guide_Option_Confirm_Not_Login"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) { if (returnVal == JOptionPane.YES_OPTION) {
@ -243,16 +244,16 @@ public class GuideCreateUtils {
FineJOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Guide_Option_Warning_Need_Network"), Toolkit.i18nText("Fine-Design_Guide_Option_Warning_Need_Network"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
} }
public static void showNoFileAuthAlert() { public static void showNoFileAuthAlert() {
FineJOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), Toolkit.i18nText("Fine-Design_Guide_Option_Warning_No_Directory_Auth"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.INFORMATION_MESSAGE JOptionPane.WARNING_MESSAGE
); );
} }
@ -292,4 +293,14 @@ public class GuideCreateUtils {
return dialog; return dialog;
} }
public static JScrollPane getParentScrollPane(Component component) {
if (component.getParent() == null) {
return null;
}
if (component.getParent() instanceof JScrollPane) {
return (JScrollPane) component.getParent();
}
return getParentScrollPane(component.getParent());
}
} }

24
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java

@ -35,10 +35,9 @@ public class ChangeLayoutComponentGuide {
public static Guide createGuide() { public static Guide createGuide() {
GuideScene scene = createScene(); GuideScene scene = createScene();
scene.nextScene(createScene2()) scene.nextScene(createScene2())
.nextScene(createScene3())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(createScene4()) .nextScene(createScene3())
.nextScene(createScene5()); .nextScene(createScene4());
Guide guide = GuideBuilder.newInstance() Guide guide = GuideBuilder.newInstance()
.setID(GuideIds.Guide.F001002) .setID(GuideIds.Guide.F001002)
@ -83,21 +82,6 @@ public class ChangeLayoutComponentGuide {
} }
private static GuideScene createScene2() { private static GuideScene createScene2() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addCustomTarget(
GuideCreateUtils.createTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
);
return true;
}
});
return scene;
}
private static GuideScene createScene3() {
ClickScene scene = new ClickScene(); ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -117,7 +101,7 @@ public class ChangeLayoutComponentGuide {
return scene; return scene;
} }
private static GuideScene createScene4() { private static GuideScene createScene3() {
DragScene scene = new DragScene(); DragScene scene = new DragScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -158,7 +142,7 @@ public class ChangeLayoutComponentGuide {
return scene; return scene;
} }
private static GuideScene createScene5() { private static GuideScene createScene4() {
DisplayScene scene = new DisplayScene(); DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override

37
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

@ -1,18 +1,24 @@
package com.fr.design.mainframe.guide.creator.layout; package com.fr.design.mainframe.guide.creator.layout;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XOccupiedLayout; import com.fr.design.designer.creator.XOccupiedLayout;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.imenu.UIHeadMenu; import com.fr.design.gui.imenu.UIHeadMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NorthRegionContainerPane; import com.fr.design.mainframe.NorthRegionContainerPane;
import com.fr.design.mainframe.guide.GuideIds; import com.fr.design.mainframe.guide.GuideIds;
import com.fr.design.mainframe.guide.base.Guide; import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideBuilder; import com.fr.design.mainframe.guide.base.GuideBuilder;
import com.fr.design.mainframe.guide.base.GuideLifecycleAdaptor; import com.fr.design.mainframe.guide.base.GuideLifecycleAdaptor;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.creator.GuideCreateUtils; import com.fr.design.mainframe.guide.creator.GuideCreateUtils;
import com.fr.design.mainframe.guide.creator.GuideSceneHelper; import com.fr.design.mainframe.guide.creator.GuideSceneHelper;
import com.fr.design.mainframe.guide.scene.ClickScene; import com.fr.design.mainframe.guide.scene.ClickScene;
@ -24,6 +30,7 @@ import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock; import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.util.InstallComponentHelper; import com.fr.design.mainframe.share.util.InstallComponentHelper;
import com.fr.design.mainframe.theme.AsyncThemeFetcher;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.widget.ui.designer.NewFormPane; import com.fr.design.widget.ui.designer.NewFormPane;
import com.fr.design.widget.ui.designer.PredefinedLayoutPane; import com.fr.design.widget.ui.designer.PredefinedLayoutPane;
@ -47,6 +54,7 @@ public class UseLayoutAndComponentGuide {
private static final String RESOURCE_PATH = "/com/fr/report/guide/component"; private static final String RESOURCE_PATH = "/com/fr/report/guide/component";
private static UIHeadMenu fileHeadMenu; private static UIHeadMenu fileHeadMenu;
private static NewFormPane newFormPane; private static NewFormPane newFormPane;
private static String defaultThemeName;
public static Guide createGuide() { public static Guide createGuide() {
GuideScene scene = createScene(); GuideScene scene = createScene();
@ -71,9 +79,25 @@ public class UseLayoutAndComponentGuide {
@Override @Override
public boolean prepared() { public boolean prepared() {
preloadShareComponent(); preloadShareComponent();
List<String> themeNames = FormThemeConfig.getInstance().getThemeNames();
if (themeNames.size() > 0) {
defaultThemeName = themeNames.get(Math.max(themeNames.size() - 2, 0));
AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(1, FormThemeConfig.getInstance());
asyncThemeFetcher.submit(defaultThemeName, new AsyncThemeFetcher.AsyncThemeFetchCallbackAdapter<FormTheme>(){
@Override
public void afterCachedFetch(FormTheme theme) {
Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File")); Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"));
fileHeadMenu = ((UIHeadMenu) component); fileHeadMenu = ((UIHeadMenu) component);
return true; asyncThemeFetcher.shutdown();
EastRegionContainerPane.getInstance().showContainer();
GuideManager.getInstance().getCurrentGuide().start();
}
});
} else {
GuideManager.getInstance().getCurrentGuide().terminate();
}
return false;
} }
@Override @Override
@ -134,7 +158,7 @@ public class UseLayoutAndComponentGuide {
scene.showScene(); scene.showScene();
GuideCreateUtils.TIMER.purge(); GuideCreateUtils.TIMER.purge();
} }
}, 100); }, 300);
return false; return false;
} }
}); });
@ -176,6 +200,15 @@ public class UseLayoutAndComponentGuide {
public boolean onComplete() { public boolean onComplete() {
newFormPane.createLayoutForm(); newFormPane.createLayoutForm();
newFormPane.getWindow().dispose(); newFormPane.getWindow().dispose();
FormTheme defaultTheme = FormThemeConfig.getInstance().cachedFetch(defaultThemeName);
if (defaultTheme != null) {
JTemplate newTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if (newTemplate instanceof JForm) {
JForm jForm = (JForm) newTemplate;
jForm.setTemplateTheme(defaultTheme);
}
}
return true; return true;
} }
}); });

45
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

@ -43,6 +43,7 @@ import javax.swing.JPopupMenu;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point; import java.awt.Point;
import java.awt.event.ContainerAdapter; import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;
@ -62,7 +63,6 @@ public class DownloadComponentPackageGuide {
.nextScene(createScene3()) .nextScene(createScene3())
.nextScene(createScene4()) .nextScene(createScene4())
.nextScene(createScene5()) .nextScene(createScene5())
.nextScene(createScene6())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()); .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene());
Guide guide = GuideBuilder.newInstance() Guide guide = GuideBuilder.newInstance()
@ -93,12 +93,13 @@ public class DownloadComponentPackageGuide {
} }
boolean loadWidgetSuccess = OnlineWidgetRepoPane.loadWidgets(); boolean loadWidgetSuccess = OnlineWidgetRepoPane.loadWidgets();
if (loadWidgetSuccess) { if (loadWidgetSuccess) {
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "layout_recommend", ".frm"); filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "download_theme", ".frm");
if (filePath == null) { if (filePath == null) {
GuideCreateUtils.showNoFileAuthAlert(); GuideCreateUtils.showNoFileAuthAlert();
GuideManager.getInstance().getCurrentGuide().terminate(); GuideManager.getInstance().getCurrentGuide().terminate();
return false; return false;
} }
EastRegionContainerPane.getInstance().showContainer();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance(); OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance();
OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class);
@ -189,7 +190,7 @@ public class DownloadComponentPackageGuide {
if (onlineWidgetPackageBlock == null) { if (onlineWidgetPackageBlock == null) {
GuideManager.getInstance().getCurrentGuide().terminate(); GuideManager.getInstance().getCurrentGuide().terminate();
} else { } else {
JScrollPane scrollPane = getParentScrollPane(onlineWidgetPackageBlock); JScrollPane scrollPane = GuideCreateUtils.getParentScrollPane(onlineWidgetPackageBlock);
scrollPane.getVerticalScrollBar().setValue(onlineWidgetPackageBlock.getY()); scrollPane.getVerticalScrollBar().setValue(onlineWidgetPackageBlock.getY());
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
@ -207,24 +208,6 @@ public class DownloadComponentPackageGuide {
} }
private static GuideScene createScene3() { private static GuideScene createScene3() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addTarget(onlineWidgetPackageBlock);
JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu();
Point location = getPopupMenuLocation();
scene.addCustomTarget(
GuideCreateUtils.createTarget(popupMenu),
GuideCreateUtils.getRelativeBounds(popupMenu, onlineWidgetPackageBlock, location.x, location.y)
);
return true;
}
});
return scene;
}
private static GuideScene createScene4() {
ClickScene scene = new ClickScene(); ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -260,7 +243,7 @@ public class DownloadComponentPackageGuide {
return scene; return scene;
} }
private static GuideScene createScene5() { private static GuideScene createScene4() {
DisplayScene scene = new DisplayScene(); DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -272,14 +255,14 @@ public class DownloadComponentPackageGuide {
scene.showScene(); scene.showScene();
GuideCreateUtils.TIMER.purge(); GuideCreateUtils.TIMER.purge();
} }
}, 100); }, 300);
return false; return false;
} }
}); });
return scene; return scene;
} }
private static GuideScene createScene6() { private static GuideScene createScene5() {
ClickScene scene = new ClickScene(); ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -305,7 +288,8 @@ public class DownloadComponentPackageGuide {
private static Point getPopupMenuLocation() { private static Point getPopupMenuLocation() {
JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu(); JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu();
return new Point((onlineWidgetPackageBlock.getWidth() - popupMenu.getWidth()) / 2, (onlineWidgetPackageBlock.getHeight()- popupMenu.getHeight()) / 2); Dimension preferredSize = popupMenu.getPreferredSize();
return new Point((onlineWidgetPackageBlock.getWidth() - preferredSize.width) / 2, (onlineWidgetPackageBlock.getHeight()- preferredSize.height) / 2);
} }
private static void closeConfirmDialog() { private static void closeConfirmDialog() {
@ -313,15 +297,4 @@ public class DownloadComponentPackageGuide {
themeConfirmDialog.dispose(); themeConfirmDialog.dispose();
} }
} }
private static JScrollPane getParentScrollPane(Component component) {
if (component.getParent() == null) {
return null;
}
if (component.getParent() instanceof JScrollPane) {
return (JScrollPane) component.getParent();
}
return getParentScrollPane(component.getParent());
}
} }

13
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

@ -28,6 +28,7 @@ import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Component; import java.awt.Component;
import java.util.List; import java.util.List;
@ -35,7 +36,6 @@ import java.util.TimerTask;
public class ThemeToggleGuide { public class ThemeToggleGuide {
private static final int PAGE_THEME_COUNT = 9; private static final int PAGE_THEME_COUNT = 9;
private static final int DEFAULT_THEME_INDEX = 4;
private static TemplateThemeUsingDialog themeDialog; private static TemplateThemeUsingDialog themeDialog;
private static String TARGET_XCREATOR_NAME = "chart00"; private static String TARGET_XCREATOR_NAME = "chart00";
private static String filePath; private static String filePath;
@ -64,11 +64,11 @@ public class ThemeToggleGuide {
@Override @Override
public boolean prepared() { public boolean prepared() {
List<String> themeNames = FormThemeConfig.getInstance().getThemeNames(); List<String> themeNames = FormThemeConfig.getInstance().getThemeNames();
themeLoadCount = Math.min(themeNames.size(), PAGE_THEME_COUNT); themeLoadCount = themeNames.size();
if (themeLoadCount == 0) { if (themeLoadCount == 0) {
GuideManager.getInstance().getCurrentGuide().terminate(); GuideManager.getInstance().getCurrentGuide().terminate();
} }
selectedThemeIndex = Math.min(themeLoadCount - 1, DEFAULT_THEME_INDEX); selectedThemeIndex = Math.max(themeLoadCount - 5, 0);
int lazyCount = themeLoadCount; int lazyCount = themeLoadCount;
AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(PAGE_THEME_COUNT, FormThemeConfig.getInstance()); AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(PAGE_THEME_COUNT, FormThemeConfig.getInstance());
for (int index = 0; index < lazyCount; index++) { for (int index = 0; index < lazyCount; index++) {
@ -82,6 +82,7 @@ public class ThemeToggleGuide {
GuideCreateUtils.showNoFileAuthAlert(); GuideCreateUtils.showNoFileAuthAlert();
GuideManager.getInstance().getCurrentGuide().terminate(); GuideManager.getInstance().getCurrentGuide().terminate();
} else { } else {
EastRegionContainerPane.getInstance().showContainer();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
asyncThemeFetcher.shutdown(); asyncThemeFetcher.shutdown();
GuideManager.getInstance().getCurrentGuide().start(); GuideManager.getInstance().getCurrentGuide().start();
@ -141,7 +142,7 @@ public class ThemeToggleGuide {
scene.showScene(); scene.showScene();
GuideCreateUtils.TIMER.purge(); GuideCreateUtils.TIMER.purge();
} }
},100); },300);
return false; return false;
} }
}); });
@ -230,7 +231,11 @@ public class ThemeToggleGuide {
if (themeDialog == null) { if (themeDialog == null) {
themeDialog = new TemplateThemeUsingDialog(); themeDialog = new TemplateThemeUsingDialog();
} }
String name = FormThemeConfig.getInstance().getThemeNames().get(selectedThemeIndex);
Component component = ComponentUtils.findComponentByName(themeDialog.getContentPane(), name);
JScrollPane scrollPane = GuideCreateUtils.getParentScrollPane(component);
GuideCreateUtils.showDialogWithoutModal(themeDialog); GuideCreateUtils.showDialogWithoutModal(themeDialog);
scrollPane.getVerticalScrollBar().setValue(component.getY());
} }
private static void closeTemplateThemeUsingDialog() { private static void closeTemplateThemeUsingDialog() {

2
designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java

@ -58,6 +58,6 @@ public class GuideEntryHint {
private Point getBubbleLocation() { private Point getBubbleLocation() {
Point point = SwingUtilities.convertPoint(GuideEntryPane.getGuideEntryPane(),0,0, guideView.getRootPane()); Point point = SwingUtilities.convertPoint(GuideEntryPane.getGuideEntryPane(),0,0, guideView.getRootPane());
Dimension size = GuideEntryPane.getGuideEntryPane().getSize(); Dimension size = GuideEntryPane.getGuideEntryPane().getSize();
return new Point(point.x - 187,point.y + size.height); return new Point(point.x - 187,point.y + size.height + 5);
} }
} }

51
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java

@ -19,24 +19,22 @@ import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.exception.LackOfValueException; import com.fr.design.mainframe.share.exception.LackOfValueException;
import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter; import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter;
import com.fr.design.mainframe.share.select.ComponentTransformerFactory; import com.fr.design.mainframe.share.select.ComponentTransformerFactory;
import com.fr.design.mod.ContentObjectManager;
import com.fr.form.share.exception.NetWorkFailedException;
import com.fr.form.share.group.DefaultShareGroup;
import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.mainframe.share.util.ShareUIUtils;
import com.fr.design.mod.ContentObjectManager;
import com.fr.design.share.effect.EffectItemGroup; import com.fr.design.share.effect.EffectItemGroup;
import com.fr.design.share.utils.EffectItemUtils; import com.fr.design.share.utils.EffectItemUtils;
import com.fr.design.share.utils.ShareDialogUtils; import com.fr.design.share.utils.ShareDialogUtils;
import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.Group;
import com.fr.form.share.config.ComponentReuseConfigManager; import com.fr.form.share.config.ComponentReuseConfigManager;
import com.fr.form.share.exception.NetWorkFailedException;
import com.fr.form.share.group.DefaultShareGroup;
import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.form.share.Group;
import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.form.share.record.ShareWidgetInfoManager;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
@ -51,7 +49,9 @@ import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -65,8 +65,6 @@ public class ShareGeneratePane extends BasicPane {
private static final Dimension DIALOG_SIZE = new Dimension(670, 760); private static final Dimension DIALOG_SIZE = new Dimension(670, 760);
private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610); private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610);
private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6); private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6);
private static final double MAX_WIDTH = 500.0;
private static final double MAX_HEIGHT = 260.0;
private JPanel mainPane = null; private JPanel mainPane = null;
private ShareMainPane uploadPane = null; private ShareMainPane uploadPane = null;
@ -213,7 +211,6 @@ public class ShareGeneratePane extends BasicPane {
dialog.setButtonEnabled(false); dialog.setButtonEnabled(false);
ShareDialogUtils.getInstance().setShareDialog(dialog); ShareDialogUtils.getInstance().setShareDialog(dialog);
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
ShareMainPane mainPane = getSelectMainPane(); ShareMainPane mainPane = getSelectMainPane();
@ -297,29 +294,11 @@ public class ShareGeneratePane extends BasicPane {
} }
private boolean generateModule(DefaultSharableWidget info) throws Exception { private boolean generateModule(DefaultSharableWidget info) throws Exception {
ComponentGenerateInfo generateInfo = new ComponentGenerateInfo(uploadCheckbox.isSelected(), jt, paraMap, shareWidget, info);
DefaultSharableWidget transformInfo = transform(info);
ComponentGenerateInfo generateInfo = new ComponentGenerateInfo(uploadCheckbox.isSelected(), jt, paraMap, shareWidget, transformInfo);
ComponentGeneratorCenter center = new ComponentGeneratorCenter(generateInfo); ComponentGeneratorCenter center = new ComponentGeneratorCenter(generateInfo);
return center.generate(); return center.generate();
} }
private DefaultSharableWidget transform(DefaultSharableWidget info) {
confineSize(info);
//先屏蔽
//if (shareWidget instanceof AbstractBorderStyleWidget) {
// AbstractBorderStyleWidget styleWidget = (AbstractBorderStyleWidget) shareWidget;
// ExtendSharableAttrMark attrMark = styleWidget.getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
// if (attrMark != null) {
// String shareId = attrMark.getShareId();
// info.setId(shareId);
// }
//}
return info;
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Share_Module_Msg"); return Toolkit.i18nText("Fine-Design_Share_Module_Msg");
@ -328,20 +307,4 @@ public class ShareGeneratePane extends BasicPane {
private Dimension getDialogSize() { private Dimension getDialogSize() {
return effectItemGroups.size() > 0 ? DIALOG_SIZE : DIALOG_NORMAL_SIZE; return effectItemGroups.size() > 0 ? DIALOG_SIZE : DIALOG_NORMAL_SIZE;
} }
private void confineSize(DefaultSharableWidget info) {
double width = info.getWidth();
double height = info.getHeight();
if (width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT)) {
double aspectRatio = width / height;
if (width / height > MAX_WIDTH / MAX_HEIGHT) {
info.setWidth((int) MAX_WIDTH);
info.setHeight((int) (MAX_WIDTH / aspectRatio));
} else {
info.setHeight((int) MAX_HEIGHT);
info.setWidth((int) (MAX_HEIGHT * aspectRatio));
}
}
}
} }

Loading…
Cancel
Save