Browse Source

Merge branch 'feature/x' of https://code.fineres.com/scm/~fly.li/design into feature/x

research/11.0
fly.li 3 years ago
parent
commit
998bc46dd7
  1. 15
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java
  2. 5
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideBuilder.java
  3. 6
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideGroup.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java
  5. 4
      designer-base/src/main/java/com/fr/design/mainframe/guide/collect/GuideCollector.java
  6. 35
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  7. 6
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/DisplayScene.java
  8. 17
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java
  9. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  10. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java
  11. 61
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java
  12. 44
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
  13. 11
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  14. 153
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  15. 41
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
  16. 163
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  17. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java
  18. 23
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java
  19. 2
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java
  20. 67
      designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
  21. 57
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  22. 14
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java
  23. 70
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  24. 66
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  25. 52
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java
  26. 19
      designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java

15
designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java

@ -15,6 +15,7 @@ public class Guide {
private String id;
private String name;
private String description;
private String completeMessage;
private GuideState state;
private GuideView guideView;
private GuideLifecycle lifecycle;
@ -32,7 +33,7 @@ public class Guide {
this.state = GuideState.NONE;
}
public String getID() {
public String getId() {
return id;
}
@ -59,6 +60,14 @@ public class Guide {
return name;
}
public String getCompleteMessage() {
return completeMessage;
}
public void setCompleteMessage(String completeMessage) {
this.completeMessage = completeMessage;
}
public GuideState getState() {
return state;
}
@ -137,7 +146,7 @@ public class Guide {
setComplete(true);
GuideCollector.getInstance().saveInfo();
guideView.dismissGuide();
GuideCompleteDialog.getInstance().showDialog(getName());
GuideCompleteDialog.getInstance().showDialog(getCompleteMessage());
end();
}
@ -149,11 +158,11 @@ public class Guide {
}
public void end() {
GuideManager.getInstance().setCurrentGuide(null);
guideView.dismissGuide();
if (lifecycle != null) {
lifecycle.onEnd();
}
GuideManager.getInstance().setCurrentGuide(null);
GuideManageDialog.getInstance().showDialog();
}

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

@ -30,6 +30,11 @@ public class GuideBuilder {
return this;
}
public GuideBuilder setCompleteMessage(String message) {
guide.setCompleteMessage(message);
return this;
}
public GuideBuilder addScene(GuideScene scene) {
guide.setScene(scene);
return this;

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

@ -14,10 +14,14 @@ public class GuideGroup {
guideList = new ArrayList<>();
}
public String getID() {
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}

4
designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java

@ -75,7 +75,7 @@ public class GuideManager {
public GuideGroup getGuideGroup(String groupId) {
for (GuideVersion version : guideVersionList) {
for (GuideGroup group : version.getGuideGroupList()) {
if (StringUtils.equals(groupId, group.getID())) {
if (StringUtils.equals(groupId, group.getId())) {
return group;
}
}
@ -87,7 +87,7 @@ public class GuideManager {
for (GuideVersion version : guideVersionList) {
for (GuideGroup group : version.getGuideGroupList()) {
for (Guide guide : group.getGuideList()) {
if (StringUtils.equals(guideId, guide.getID())) {
if (StringUtils.equals(guideId, guide.getId())) {
return guide;
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/guide/collect/GuideCollector.java

@ -55,7 +55,7 @@ public class GuideCollector implements XMLable {
public void load() {
for(Guide cacheGuide : cacheGuides) {
Guide guide = GuideManager.getInstance().getGuide(cacheGuide.getID());
Guide guide = GuideManager.getInstance().getGuide(cacheGuide.getId());
if (guide != null) {
guide.setComplete(cacheGuide.isComplete());
}
@ -139,7 +139,7 @@ public class GuideCollector implements XMLable {
writer.attr("showHint", showHint);
for(Guide guide : GuideManager.getInstance().getAllGuide()) {
writer.startTAG(GUIDE_XML);
writer.attr("id", guide.getID());
writer.attr("id", guide.getId());
writer.attr("isComplete", guide.isComplete());
writer.end();
}

35
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -72,9 +72,10 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
if (component instanceof JComponent) {
JComponent jComponent = (JComponent) component;
image = ScreenImage.createImage(jComponent);
} else if (component instanceof Window) {
image = ScreenImage.createImage(component);
} else {
image = captureImage(component);
showContainer();
}
targetList.add(component);
highlightList.add(getTargetComponentWithImage(image, rectangle));
@ -279,49 +280,46 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
@Override
public void start() {
clear();
showContainer();
if (lifecycle != null && !lifecycle.prepared()) {
return;
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
showScene();
}
});
}
@Override
public void showScene() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (container != null) {
container.setContentPane(this);
this.setBounds(0, 0 , getSceneWidth(), getSceneWidth());
container.setContentPane(AbstractGuideScene.this);
setBounds(0, 0 , getSceneWidth(), getSceneWidth());
// show target
for (int index = highlightList.size() - 1; index >= 0; index--) {
this.add(highlightList.get(index));
add(highlightList.get(index));
}
// show next button
if (nextButton != null) {
nextButton.setBounds((getSceneWidth() - 60) / 2, getSceneHeight() - 100, 60, 30);
this.add(nextButton);
add(nextButton);
}
container.revalidate();
container.repaint();
}
showContainer();
if (lifecycle != null) {
lifecycle.onShow();
}
}
});
}
@Override
public void complete() {
container.getLayeredPane().remove(this);
container.repaint();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (lifecycle != null) {
lifecycle.onComplete();
}
@ -332,13 +330,18 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
if (nextScene instanceof AbstractGuideScene) {
((AbstractGuideScene) nextScene).setContainer(container);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
nextScene.start();
}
});
} else {
GuideManager.getInstance().getCurrentGuide().complete();
}
}
});
}
@Override

6
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/DisplayScene.java

@ -6,6 +6,7 @@ import java.util.TimerTask;
public class DisplayScene extends AbstractGuideScene {
private long delay;
private static final long DEFAULT_DELAY = 1000;
private static Timer displayTimer = new Timer();
public DisplayScene() {
this(DEFAULT_DELAY);
@ -24,10 +25,13 @@ public class DisplayScene extends AbstractGuideScene {
public void showScene() {
super.showScene();
// 实例化Timer类
new Timer().schedule(new TimerTask() {
displayTimer.schedule(new TimerTask() {
@Override
public void run() {
complete();
displayTimer.purge();
}
}, delay);
}
}

17
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java

@ -1,9 +1,12 @@
package com.fr.design.mainframe.guide.ui;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.guide.collect.GuideCollector;
import javax.swing.JDialog;
import java.awt.Color;
import java.awt.Point;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -11,6 +14,15 @@ import java.awt.event.ActionListener;
public class BubbleHintDialog extends JDialog {
private static final int DIALOG_WIDTH = 220;
private static final int DIALOG_HEIGHT = 140;
private static BubbleHintDialog dialog;
public static BubbleHintDialog getInstance(){
if (dialog == null) {
dialog = new BubbleHintDialog(DesignerContext.getDesignerFrame());
}
return dialog;
}
public BubbleHintDialog(Window parent) {
super(parent);
setUndecorated(true);
@ -27,4 +39,9 @@ public class BubbleHintDialog extends JDialog {
});
this.setContentPane(bubbleHint);
}
public void showDialog(Point location) {
dialog.setLocation(location);
dialog.setVisible(true);
}
}

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

@ -110,7 +110,7 @@ public class GuideCompleteDialog extends JDialog {
}
public void showDialog(String str) {
textArea.setText(Toolkit.i18nText("Fine-Design_Guide_Complete_Hint", str));
textArea.setText(str);
repaint();
this.setVisible(true);
}

4
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java

@ -65,7 +65,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
}
};
columnChartPanel.setLayout(new BorderLayout());
columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Column_Title"));
columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Comp_Title1"));
columnChartPanel.add(columnChartPreviewPane, BorderLayout.CENTER);
JPanel pieChartPanel = new UINoOpaquePanel() {
@ -74,7 +74,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
}
};
pieChartPanel.setLayout(new BorderLayout());
pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Pie_Title"));
pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Comp_Title2"));
pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER);
chartContent.add(columnChartPanel, BorderLayout.CENTER);
chartContent.add(pieChartPanel, BorderLayout.EAST);

61
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java

@ -2,20 +2,16 @@ package com.fr.design.mainframe.theme.preview.ecpreview;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.preview.UINoOpaquePanel;
import com.fr.design.mainframe.theme.preview.ecpreview.cell.AbstractPreviewCell;
import com.fr.design.mainframe.theme.preview.ecpreview.cell.PreviewCell;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
@ -25,70 +21,41 @@ import java.util.List;
* Created by Starryi on 2021/8/13
*/
public class ECPreviewPane extends AbstractECPreviewPane {
private static String csv =
"城市 当月目标 当月完成 月完成率 年完成率\n" +
"合肥市 248,938 348,938 140% 140%\n" +
"邵阳市 248,938 348,938 140% 140%\n" +
"合计 1,071,460 1,371,460 128% 128%";
private final List<String[]> DATA_LIST = createDataList();
private static final String BLANK_CHAR = " ";
private List<AbstractPreviewCell> headerCellList = new ArrayList<>();
private List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private List<AbstractPreviewCell> hightLightCellList = new ArrayList<>();
private List<String[]> createDataList() {
List<String[]> data = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new StringReader(csv))) {
String textLine;
while ((textLine = reader.readLine()) != null) {
String[] texts = textLine.split(BLANK_CHAR);
data.add(texts);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return data;
}
private final List<AbstractPreviewCell> headerCellList = new ArrayList<>();
private final List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
private static final int COL_COUNT = 5;
private static final int CONTENT_ROW_COUNT = 2;
public ECPreviewPane() {
this.setPreferredSize(new Dimension(517, 147));
this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
String[] titleArr = DATA_LIST.get(0);
String[] endArr = DATA_LIST.get(DATA_LIST.size() - 1);
JPanel titlePane = new UINoOpaquePanel(new GridLayout());
this.add(titlePane, BorderLayout.NORTH);
for (String title : titleArr) {
PreviewCell cell = new PreviewCell(title);
for (int i = 0; i < COL_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
cell.setPreferredSize(new Dimension(103, 36));
titlePane.add(cell);
headerCellList.add(cell);
}
JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0));
this.add(contentPane, BorderLayout.CENTER);
for (int i = 1; i < DATA_LIST.size() - 1; i++) {
String[] textLine = DATA_LIST.get(i);
for (int j = 0; j < textLine.length; j++) {
String text = textLine[j];
PreviewCell cell = new PreviewCell(text);
for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
cell.setPreferredSize(new Dimension(103, 33));
contentPane.add(cell);
contentCellList.add(cell);
}
}
JPanel endPane = new UINoOpaquePanel(new GridLayout());
this.add(endPane, BorderLayout.SOUTH);
for (String text : endArr) {
PreviewCell cell = new PreviewCell(text);
for (int i = 0; i < COL_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
cell.setPreferredSize(new Dimension(103, 33));
endPane.add(cell);
hightLightCellList.add(cell);
highLightCellList.add(cell);
}
}
@Override
@ -96,7 +63,7 @@ public class ECPreviewPane extends AbstractECPreviewPane {
ThemedCellStyleList cellStyleConfig = theme.getCellStyleList();
refresh(headerCellList, getReportHeaderStyle(cellStyleConfig));
refresh(contentCellList, getMainContentStyle(cellStyleConfig));
refresh(hightLightCellList, getHighLightStyle(cellStyleConfig));
refresh(highLightCellList, getHighLightStyle(cellStyleConfig));
}

44
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

@ -22,13 +22,15 @@ import java.util.ArrayList;
import java.util.List;
public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreviewed<ReportTheme> {
private List<AbstractPreviewCell> headerTitleCellList = new ArrayList<>();
private List<AbstractPreviewCell> headerCellList = new ArrayList<>();
private List<AbstractPreviewCell> titleCellList = new ArrayList<>();
private List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
private final List<AbstractPreviewCell> headerTitleCellList = new ArrayList<>();
private final List<AbstractPreviewCell> headerCellList = new ArrayList<>();
private final List<AbstractPreviewCell> titleCellList = new ArrayList<>();
private final List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
private static final int CONTENT_ROW_COUNT = 3;
private static final int COL_COUNT = 5;
private PreviewPane previewPane;
private final PreviewPane previewPane;
public ECReportPreviewPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -58,26 +60,26 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
private JPanel createNorthPane() {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
AbstractPreviewCell bigTitleCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Big_Title"));
AbstractPreviewCell bigTitleCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Cell_Style_Big_Title"));
bigTitleCell.setPreferredSize(new Dimension(615, 46));
headerTitleCellList.add(bigTitleCell);
northPane.add(bigTitleCell, BorderLayout.NORTH);
CornerPreviewCell cornerCell = new CornerPreviewCell(new String[]{Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Product"),
Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Statistical_Dimension")},
CornerPreviewCell cornerCell = new CornerPreviewCell(new String[]{Toolkit.i18nText("Fine-Design_Basic_Column_Name"),
Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Row_Name")},
new Point2D[]{new Point(159, 71), new Point(225, 49)});
cornerCell.setPreferredSize(new Dimension(225, 71));
headerCellList.add(cornerCell);
northPane.add(cornerCell, BorderLayout.WEST);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
northPane.add(centerPane, BorderLayout.CENTER);
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Statistical_By_Area"));
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title"));
titleCellList.add(cell);
cell.setPreferredSize(new Dimension(308, 38));
centerPane.add(cell, BorderLayout.NORTH);
JPanel eastSouthPane = new UINoOpaquePanel(new GridLayout());
PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_East_China"));
PreviewCell cell2 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_South_China"));
PreviewCell cell3 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Subtotal"));
PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
PreviewCell cell2 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
PreviewCell cell3 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
headerCellList.add(cell1);
headerCellList.add(cell2);
headerCellList.add(cell3);
@ -92,13 +94,13 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
JPanel westPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
centerPane.add(westPane, BorderLayout.WEST);
PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Drink"));
PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title"));
titleCellList.add(cell1);
cell1.setPreferredSize(new Dimension(112, 153));
westPane.add(cell1, BorderLayout.WEST);
JPanel gridPane = new UINoOpaquePanel(new GridLayout(5, 1));
for (int i = 0; i < 5; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Apple_Juice"));
for (int i = 0; i < COL_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
cell.setPreferredSize(new Dimension(113, 31));
headerCellList.add(cell);
gridPane.add(cell);
@ -107,14 +109,16 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
JPanel innerCenterPane = new UINoOpaquePanel(new GridLayout(5, 3));
centerPane.add(innerCenterPane, BorderLayout.CENTER);
for (int i = 0; i < 15; i++) {
PreviewCell cell = new PreviewCell("35600");
cell.setPreferredSize(new Dimension(123, 31));
if ((i + 1) % 3 == 0) {
for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) {
PreviewCell cell ;
if ((i + 1) % CONTENT_ROW_COUNT == 0) {
cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
highLightCellList.add(cell);
} else {
cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
contentCellList.add(cell);
}
cell.setPreferredSize(new Dimension(123, 31));
innerCenterPane.add(cell);
}

11
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -6,7 +6,6 @@ import com.fr.base.Parameter;
import com.fr.base.Releasable;
import com.fr.base.extension.FileExtension;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.iofile.attr.TemplateLayoutIdAttrMark;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.base.theme.TemplateTheme;
@ -117,7 +116,6 @@ import java.util.List;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form>, Releasable {
private static final String FORM_CARD = "FORM";
private static final String ELEMENTCASE_CARD = "ELEMENTCASE";
private static final String EMPTY_FORM_LAYOUTID = "9ebf6aff-ad53-45a9-a175-9633f4162a3a";
private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD};
private static final int TOOLBARPANEDIMHEIGHT_FORM = 60;
@ -138,8 +136,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
protected int index = FORM_TAB;
public JForm() {
super(new Form(new WBorderLayout("form")), "Form");
initEmptyFormLayoutId();
this(new Form(new WBorderLayout("form")));
}
public JForm(Form form) {
@ -154,12 +151,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
super(form, file);
}
private void initEmptyFormLayoutId() {
Form form = this.getTarget();
form.addAttrMark(new TemplateLayoutIdAttrMark(EMPTY_FORM_LAYOUTID));
form.setLayoutId(EMPTY_FORM_LAYOUTID);
}
@Override
protected void addPane(PropertyItemPaneProvider provider) {

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

@ -0,0 +1,153 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.workspace.WorkContext;
import javax.swing.Action;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.event.ActionEvent;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/28
*/
public class DownloadSuitableThemeAction extends UpdateAction {
private final String themePath;
private boolean downloading = false;
public DownloadSuitableThemeAction(String themePath) {
this.themePath = themePath;
this.putValue(Action.SMALL_ICON, null);
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme"));
}
@Override
public void actionPerformed(ActionEvent e) {
if (checkAuthority()) {
saveTheme();
}
}
private boolean checkAuthority() {
if (!WorkContext.getCurrent().isRoot()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Message"),
Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Title"),
JOptionPane.WARNING_MESSAGE);
return false;
}
String userName = DesignerEnvManager.getEnvManager().getDesignerLoginUsername();
if (StringUtils.isEmpty(userName)) {
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL);
return false;
}
return true;
}
private void saveTheme() {
if (downloading) {
return;
}
downloading = true;
final JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() {
FormTheme theme = fetchRemoteTheme();
if (theme == null) {
return false;
}
theme = ensureThemeHasUniqueName(theme, theme.getName());
if (theme == null) {
return false;
}
String themeName = theme.getName();
saveThemeToConfig(theme, new SaveToThemeConfigCallback(template, themeName));
return true;
}
@Override
protected void done() {
downloading = false;
}
}.execute();
}
private FormTheme fetchRemoteTheme() {
return DownloadUtils.downloadThemeFile(themePath);
}
private FormTheme ensureThemeHasUniqueName(FormTheme theme, String expectedName) {
if (!FormThemeConfig.getInstance().contains(expectedName)) {
theme.setName(expectedName);
return theme;
} else {
String newName = (String) FineJOptionPane.showInputDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Rename_Suitable_Theme_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Rename"),
FineJOptionPane.QUESTION_MESSAGE, null, null,
expectedName);
return StringUtils.isEmpty(newName) ? null : ensureThemeHasUniqueName(theme, newName);
}
}
private void saveThemeToConfig(final FormTheme theme, CallBackAdaptor callback) {
FormThemeConfig.getInstance().addTheme(theme, true, callback);
}
public static class SaveToThemeConfigCallback extends CallBackAdaptor {
private final JTemplate<?,?> template;
private final String themeName;
public SaveToThemeConfigCallback(JTemplate<?, ?> template, String themeName) {
this.template = template;
this.themeName = themeName;
}
@Override
public void afterCommit() {
super.afterCommit();
int returnVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Apply_Suitable_Theme_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
FineJOptionPane.OK_CANCEL_OPTION);
if (returnVal == JOptionPane.YES_OPTION) {
applyTheme(template, themeName);
}
}
private void applyTheme(JTemplate<?,?> template, final String name) {
TemplateThemeConfig<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig();
TemplateTheme theme = config.cachedFetch(name);
template.setTemplateTheme(theme);
}
}
}

41
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java

@ -0,0 +1,41 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.actions.UpdateAction;
import com.fr.design.i18n.Toolkit;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.stable.StringUtils;
import javax.swing.Action;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/28
*/
public class Jump2DetailAction extends UpdateAction {
private static final String ONLINE_WIDGET_DETAIL_FORMATTED_URL = "https://market.fanruan.com/reuse/%s";
private final String id;
public Jump2DetailAction(String id) {
this.id = id;
this.putValue(Action.SMALL_ICON, null);
this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail"));
}
@Override
public void actionPerformed(ActionEvent e) {
if (StringUtils.isNotEmpty(id)) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI(String.format(ONLINE_WIDGET_DETAIL_FORMATTED_URL, id)));
} catch (IOException | URISyntaxException ioException) {
ioException.printStackTrace();
}
}
}
}

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

@ -1,25 +1,13 @@
package com.fr.design.mainframe.share.ui.block;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction;
import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction;
import com.fr.design.mainframe.share.ui.online.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.ResourceLoader;
import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.form.share.constants.ShareComponentConstants;
@ -27,31 +15,21 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.third.springframework.web.util.UriUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import javax.imageio.ImageIO;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.SwingWorker;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
/**
* Created by kerry on 2020-11-22
*/
public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<OnlineShareWidget> implements ResourceLoader {
private static final String ONLINE_WIDGET_DETAIL_FORMATTED_URL = "https://market.fanruan.com/reuse/%s";
private final OnlineWidgetSelectPane parentPane;
private UILabel coverLabel;
@ -145,144 +123,9 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile).createMenuItem());
}
popupMenu.add(new Jump2DetailAction().createMenuItem());
popupMenu.add(new Jump2DetailAction(getWidget().getId()).createMenuItem());
return popupMenu;
}
private static class DownloadSuitableThemeAction extends UpdateAction {
private final String themePath;
private boolean downloading = false;
public DownloadSuitableThemeAction(String themePath) {
this.themePath = themePath;
this.putValue(Action.SMALL_ICON, null);
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme"));
}
@Override
public void actionPerformed(ActionEvent e) {
if (checkAuthority()) {
saveTheme();
}
}
private boolean checkAuthority() {
if (!WorkContext.getCurrent().isRoot()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Message"),
Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Title"),
JOptionPane.WARNING_MESSAGE);
return false;
}
String userName = DesignerEnvManager.getEnvManager().getDesignerLoginUsername();
if (StringUtils.isEmpty(userName)) {
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL);
return false;
}
return true;
}
private void saveTheme() {
if (downloading) {
return;
}
downloading = true;
final JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() {
FormTheme theme = fetchRemoteTheme();
if (theme == null) {
return false;
}
theme = ensureThemeHasUniqueName(theme, theme.getName());
if (theme == null) {
return false;
}
String themeName = theme.getName();
saveThemeToConfig(theme, new CallBackAdaptor() {
@Override
public void afterCommit() {
super.afterCommit();
int returnVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Apply_Suitable_Theme_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
FineJOptionPane.OK_CANCEL_OPTION);
if (returnVal == JOptionPane.YES_OPTION) {
applyTheme(template, themeName);
}
}
});
return true;
}
@Override
protected void done() {
downloading = false;
}
}.execute();
}
private FormTheme fetchRemoteTheme() {
return DownloadUtils.downloadThemeFile(themePath);
}
private FormTheme ensureThemeHasUniqueName(FormTheme theme, String expectedName) {
if (!FormThemeConfig.getInstance().contains(expectedName)) {
theme.setName(expectedName);
return theme;
} else {
String newName = (String) FineJOptionPane.showInputDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Rename_Suitable_Theme_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Rename"),
FineJOptionPane.QUESTION_MESSAGE, null, null,
expectedName);
return StringUtils.isEmpty(newName) ? null : ensureThemeHasUniqueName(theme, newName);
}
}
private void saveThemeToConfig(final FormTheme theme, CallBackAdaptor callback) {
FormThemeConfig.getInstance().addTheme(theme, true, callback);
}
private void applyTheme(JTemplate<?,?> template, final String name) {
TemplateThemeConfig<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig();
TemplateTheme theme = config.cachedFetch(name);
template.setTemplateTheme(theme);
}
}
private class Jump2DetailAction extends UpdateAction {
public Jump2DetailAction() {
this.putValue(Action.SMALL_ICON, null);
this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail"));
}
@Override
public void actionPerformed(ActionEvent e) {
OnlineShareWidget widget = getWidget();
String id = widget.getId();
if (StringUtils.isNotEmpty(id)) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI(String.format(ONLINE_WIDGET_DETAIL_FORMATTED_URL, id)));
} catch (IOException | URISyntaxException ioException) {
ioException.printStackTrace();
}
}
}
}
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java

@ -40,7 +40,7 @@ import java.util.List;
* @Author: Yuan.Wang
* @Date: 2020/11/5
*/
class GroupPane extends JPanel {
public class GroupPane extends JPanel {
private static final Icon downIcon = IOUtils.readIcon("/com/fr/base/images/share/arrow_down.png");
private static final Icon rightIcon = IOUtils.readIcon("/com/fr/base/images/share/arrow_right.png");
private static final int DEFAULT_HEIGHT = 24;

23
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java

@ -21,7 +21,7 @@ import java.io.InputStream;
public class InstallComponentHelper {
private static final String PRE_INSTALL_PATH = "/com/fr/form/share/components";
public static final String[] PRE_INSTALL_COMPONENTS = new String[]{
private static final String[] PRE_INSTALL_COMPONENTS = new String[]{
"单行指标卡.f3df58b3-4302-4cab-ab77-caaf225de60a.reu",
"分层雷达图-深色.49f8397c-e6a6-482a-acc7-46d8cec353a4.reu",
"红绿灯表格-浅色.d0466992-328a-4ccf-ad67-6cbc844d669c.reu",
@ -32,34 +32,21 @@ public class InstallComponentHelper {
public static void installPreComponent() {
if (needPreInstallComponent()) {
for (String componentPath : PRE_INSTALL_COMPONENTS) {
try {
InputStream inputStream = InstallComponentHelper.class.getResourceAsStream(StableUtils.pathJoin(PRE_INSTALL_PATH, componentPath));
byte[] data = ResourceIOUtils.inputStream2Bytes(inputStream);
WorkContext.getWorkResource().write(StableUtils.pathJoin(ComponentPath.SHARE_PATH.path(), componentPath), data);
} catch (Exception e) {
FineLoggerFactory.getLogger().error("install Component filed" + e.getMessage(), e);
}
}
installShareComponents(PRE_INSTALL_PATH, PRE_INSTALL_COMPONENTS);
}
}
public static String[] installPreComponent(int count) {
count = Math.max(Math.min(count, PRE_INSTALL_COMPONENTS.length), 0);
String[] installNames = new String[count];
for (int index = 0; index < count; index ++) {
public static void installShareComponents(String resourcePath, String[] components) {
for (String componentPath : components) {
try {
String componentPath = PRE_INSTALL_COMPONENTS[index];
InputStream inputStream = InstallComponentHelper.class.getResourceAsStream(StableUtils.pathJoin(PRE_INSTALL_PATH, componentPath));
InputStream inputStream = InstallComponentHelper.class.getResourceAsStream(StableUtils.pathJoin(resourcePath, componentPath));
byte[] data = ResourceIOUtils.inputStream2Bytes(inputStream);
WorkContext.getWorkResource().write(StableUtils.pathJoin(ComponentPath.SHARE_PATH.path(), componentPath), data);
installNames[index] = componentPath;
} catch (Exception e) {
FineLoggerFactory.getLogger().error("install Component filed" + e.getMessage(), e);
}
}
return installNames;
}
private static boolean needPreInstallComponent() {

2
designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

@ -43,8 +43,8 @@ public class DeveloperPreview extends AbstractPreviewProvider {
@Override
public void onClick(JTemplate<?, ?> jt) {
MutilTempalteTabPane.getInstance().closeCurrentTpl();
super.onClick(jt);
MutilTempalteTabPane.getInstance().closeCurrentTpl();
}

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

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.iofile.attr.TemplateLayoutIdAttrMark;
import com.fr.design.border.UITitledMatteBorder;
import com.fr.design.designer.beans.PredefinedLayout;
import com.fr.design.designer.beans.models.NewFormModel;
@ -15,6 +16,11 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.main.Form;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.OccupiedLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
@ -43,6 +49,8 @@ import java.util.List;
import java.util.Map;
public class NewFormPane extends BasicPane {
private static final String EMPTY_FORM_LAYOUTID = "9ebf6aff-ad53-45a9-a175-9633f4162a3a";
private NewFormModel newFormModel;
private UIDialog dialog;
private PredefinedLayoutPane selectedLayoutPane = null;
@ -276,19 +284,66 @@ public class NewFormPane extends BasicPane {
private void newForm(String path) {
BaseJForm jForm;
try {
if (StringUtils.isNotEmpty(path)) {
Form form = new Form();
form.readStream(NewFormPane.class.getResourceAsStream(path));
Form form = initEmptyBodyForm();
initLayoutInfo(form, path);
jForm = StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, new Object[]{form}, BaseJForm.class);
} else {
jForm = StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, BaseJForm.class);
}
DesignerContext.getDesignerFrame().addAndActivateJTemplate((JTemplate<?, ?>) jForm);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private Form initEmptyBodyForm() {
WFitLayout body = new WFitLayout();
WBorderLayout borderLayout = new WBorderLayout("form");
borderLayout.addCenter(body);
return new Form(borderLayout);
}
/**
* 通过布局文件的位置初始化Form对象的布局信息
*
* @param form 新建的form对象
* @param path 布局文件位置
* @throws Exception
*/
private void initLayoutInfo(Form form, String path) throws Exception {
if (isNewEmptyForm(path)) {
initEmptyFormLayoutId(form);
} else {
Form layoutTemplate = new Form();
layoutTemplate.readStream(NewFormPane.class.getResourceAsStream(path));
if (layoutTemplate.getBody() != null && layoutTemplate.getBody() instanceof WFitLayout) {
WFitLayout layoutTemplateBody = (WFitLayout) layoutTemplate.getBody();
WFitLayout body = (WFitLayout) form.getBody();
body.setMargin(layoutTemplateBody.getMargin());
body.setCompInterval(layoutTemplateBody.getCompInterval());
for (int i = 0; i < layoutTemplateBody.getWidgetCount(); i++) {
Widget boundsWidget = layoutTemplateBody.getWidget(i);
if (boundsWidget != null && boundsWidget instanceof BoundsWidget) {
Widget widget = ((BoundsWidget) boundsWidget).getWidget();
if (widget != null && widget instanceof OccupiedLayout) {
body.addWidget((Widget) boundsWidget.clone());
}
}
}
form.setLayoutId(layoutTemplate.getLayoutId());
}
}
}
private void initEmptyFormLayoutId(Form form) {
form.addAttrMark(new TemplateLayoutIdAttrMark(EMPTY_FORM_LAYOUTID));
form.setLayoutId(EMPTY_FORM_LAYOUTID);
}
private boolean isNewEmptyForm(String layoutTemplatePath) {
return StringUtils.isEmpty(layoutTemplatePath);
}
private void setSelectedLayoutPane(PredefinedLayoutPane layoutPane) {
if (selectedLayoutPane != layoutPane) {
if (selectedLayoutPane != null) {

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

@ -21,15 +21,18 @@ import com.fr.workspace.WorkContext;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.io.InputStream;
import java.util.Timer;
import java.util.UUID;
public class GuideCreateUtils {
private static final String FILE_PREFIX = "Guide_";
public static Timer TIMER = new Timer();
public static FormDesigner getFormDesigner() {
JForm jForm = (JForm) DesignerContext.getDesignerFrame().getSelectedJTemplate();
FormDesigner designer = jForm.getFormDesign();
@ -39,9 +42,37 @@ public class GuideCreateUtils {
public static Rectangle getXCreatorBoundsRelative2FormDesigner(XCreator xCreator) {
FormDesigner designer = getFormDesigner();
Point point = SwingUtilities.convertPoint(xCreator, 0, 0, designer.getRootComponent());
Rectangle bounds = new Rectangle(point.x + designer.getPaintX() - designer.getHorizontalScaleValue(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight());
bounds.intersection(new Rectangle(point.x, point.y, designer.getWidth(), designer.getHeight()));
return bounds;
}
public static Rectangle getXCreatorBoundsRelative2FormDesigner(String widgetName) {
FormDesigner designer = getFormDesigner();
XCreator xCreator = getXCreatorFormDesigner(widgetName);
if (xCreator == null) {
return new Rectangle(0,0,0,0);
}
Point point = SwingUtilities.convertPoint(getXCreatorFormDesigner(widgetName), 0, 0, designer.getRootComponent());
return new Rectangle(point.x + designer.getPaintX() - designer.getHorizontalScaleValue(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight());
}
public static Rectangle getXCreatorBoundsRelative2GuideView(String widgetName) {
XCreator xCreator = getXCreatorFormDesigner(widgetName);
Point designerLocationToGuideView = SwingUtilities.convertPoint(getFormDesigner(),0,0, GuideManager.getInstance().getCurrentGuide().getGuideView().getRootPane());
if (xCreator == null) {
return new Rectangle(designerLocationToGuideView.x, designerLocationToGuideView.y ,0,0);
}
Rectangle boundsRelative2Designer = getXCreatorBoundsRelative2FormDesigner(xCreator);
return new Rectangle(
designerLocationToGuideView.x + boundsRelative2Designer.x,
designerLocationToGuideView.y + boundsRelative2Designer.y,
boundsRelative2Designer.width,
boundsRelative2Designer.height
);
}
public static XCreator getXCreatorFormDesigner(String name) {
FormDesigner designer = getFormDesigner();
XLayoutContainer rootComponent = designer.getRootComponent();
@ -49,6 +80,13 @@ public class GuideCreateUtils {
}
public static void selectXCreatorByWidgetName(String widgetName) {
FormDesigner designer = GuideCreateUtils.getFormDesigner();
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName);
designer.getSelectionModel().reset();
designer.getSelectionModel().selectACreator(xCreator);
}
public static XCreator findXCreator(XLayoutContainer container, String name) {
if (StringUtils.equals(container.toData().getWidgetName(), name)) {
return container;
@ -95,13 +133,18 @@ public class GuideCreateUtils {
return new UILabel(ic);
}
public static Rectangle getPopupMenuBounds(JPopupMenu popupMenu, Component parent, int x, int y) {
public static UILabel createTarget(JComponent component) {
ImageIcon ic = new ImageIcon(ScreenImage.createImage(component));
return new UILabel(ic);
}
public static Rectangle getRelativeBounds(JComponent component, Component parent, int x, int y) {
Point point = SwingUtilities.convertPoint(parent,0,0, GuideManager.getInstance().getCurrentGuide().getGuideView().getRootPane());
return new Rectangle(point.x + x, point.y + y, popupMenu.getWidth(), popupMenu.getHeight());
return new Rectangle(point.x + x, point.y + y, component.getWidth(), component.getHeight());
}
public static String openGuideFile(String sourcePath, String fileName, String suffix) {
String fileWorkPath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, UUID.randomUUID().toString() + suffix);
String fileWorkPath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, FILE_PREFIX + UUID.randomUUID().toString() + suffix);
InputStream inputStream = GuideCreateUtils.class.getResourceAsStream(StableUtils.pathJoin(sourcePath, fileName + suffix));
byte[] data = ResourceIOUtils.inputStream2Bytes(inputStream);
WorkContext.getWorkResource().write(fileWorkPath, data);
@ -113,9 +156,11 @@ public class GuideCreateUtils {
WorkContext.getWorkResource().delete(filePath);
}
public static void openDialogWithoutModal(JDialog dialog) {
public static void showDialogWithoutModal(JDialog dialog) {
dialog.setModal(false);
dialog.setVisible(true);
}
}

14
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java

@ -19,18 +19,6 @@ import com.fr.design.utils.ComponentUtils;
import java.awt.Window;
public class GuideSceneHelper {
public static GuideScene createWindowDisplayScene(Window window) {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addTarget(window);
return true;
}
});
return scene;
}
public static GuideScene createFormDesignerBodyDisplayScene() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@ -63,7 +51,7 @@ public class GuideSceneHelper {
return scene;
}
public static GuideScene createSelectXCretorClickScene(String widgetName) {
public static GuideScene createSelectXCreatorClickScene(String widgetName) {
ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override

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

@ -20,24 +20,32 @@ import com.fr.design.mainframe.guide.scene.GuideScene;
import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.utils.ComponentUtils;
import javax.swing.SwingUtilities;
import java.awt.Point;
import java.awt.Rectangle;
public class ChangeLayoutComponentGuide {
private static final String TARGET_FROM_NAME = "chart0";
private static final String TARGET_TO_NAME = "chart1";
private static UIButton switchButton;
private static String filePath;
public static Guide createGuide() {
GuideScene scene = createScene();
scene.nextScene(createScene2())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(createScene3())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(createScene4())
.nextScene(createScene5())
.nextScene(GuideSceneHelper.createPreviewClickScene());
Guide guide = GuideBuilder.newInstance()
.setID(GuideIds.Guide.F001002)
.setName(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Name"))
.setDescription(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Description"))
.setCompleteMessage(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Complete_Message"))
.addScene(scene)
.registerLifecycle(new GuideLifecycleAdaptor() {
@Override
@ -71,31 +79,65 @@ public class ChangeLayoutComponentGuide {
}
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();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
switchButton.getComponentPopupMenu().setVisible(true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
scene.addCustomTarget(
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getPopupMenuBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f);
scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f);
switchButton.getComponentPopupMenu().setVisible(false);
return true;
scene.showScene();
}
});
return false;
}
});
return scene;
}
private static GuideScene createScene3() {
private static GuideScene createScene4() {
DragScene scene = new DragScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getXCreatorFormDesigner("absolute0")), DragScene.DragType.FROM);
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getXCreatorFormDesigner("absolute1")), DragScene.DragType.TO);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Drag"), GuideTip.Direction.TOP);
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_FROM_NAME), DragScene.DragType.FROM);
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_TO_NAME), DragScene.DragType.TO);
Rectangle fromBounds = GuideCreateUtils.getXCreatorBoundsRelative2GuideView(TARGET_FROM_NAME);
Rectangle toBounds = GuideCreateUtils.getXCreatorBoundsRelative2GuideView(TARGET_TO_NAME);
Point lineArrowPoint1 = new Point(fromBounds.x + fromBounds.width / 2, fromBounds.y - 5);
Point lineArrowPoint2 = new Point(fromBounds.x + fromBounds.width / 2, fromBounds.y - 25);
Point lineArrowPoint3 = new Point(toBounds.x + toBounds.width / 2, toBounds.y - 25);
Point lineArrowPoint4 = new Point(toBounds.x + toBounds.width / 2, toBounds.y - 5);
scene.addLineArrow(lineArrowPoint1, lineArrowPoint2, lineArrowPoint3, lineArrowPoint4);
Point bubbleAnchor = new Point((lineArrowPoint2.x + lineArrowPoint3.x) / 2, lineArrowPoint2.y);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Drag"), null, GuideTip.Direction.TOP, bubbleAnchor, 0.5f);
return super.prepared();
}
@ -103,8 +145,8 @@ public class ChangeLayoutComponentGuide {
public void onComplete() {
FormDesigner formDesigner = GuideCreateUtils.getFormDesigner();
XCreator from = GuideCreateUtils.getXCreatorFormDesigner("absolute0");
XLayoutContainer to = (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("absolute1");
XCreator from = GuideCreateUtils.getXCreatorFormDesigner(TARGET_FROM_NAME);
XLayoutContainer to = (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner(TARGET_TO_NAME);
formDesigner.getSelectionModel().removeCreator(from, from.getWidth(), from.getHeight());
formDesigner.getSelectionModel().removeCreator(to, to.getWidth(),to.getHeight());
@ -116,15 +158,13 @@ public class ChangeLayoutComponentGuide {
return scene;
}
private static GuideScene createScene4() {
private static GuideScene createScene5() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
Rectangle rootBounds = GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getFormDesigner().getRootComponent());
Rectangle bound3 = GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getXCreatorFormDesigner("absolute2"));
Rectangle targetBounds = new Rectangle(rootBounds.x, rootBounds.y, rootBounds.width, bound3.y - rootBounds.y);
scene.addTarget(GuideCreateUtils.getFormDesigner(), targetBounds);
scene.addTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_FROM_NAME));
scene.addTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_TO_NAME));
return true;
}
});

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

@ -30,15 +30,22 @@ import com.fr.design.widget.ui.designer.PredefinedLayoutPane;
import com.fr.form.share.Group;
import com.fr.form.share.group.DefaultShareGroup;
import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.stable.StringUtils;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.TimerTask;
public class UseLayoutAndComponentGuide {
private static final String[] PRE_INSTALL_COMPONENTS = {
"大屏标题-酷炫蓝.25fcd194-d4db-406f-8a08-210f3c262870.reu",
"散点闪烁地图-酷炫蓝.5e17c2eb-5b18-4b6c-854a-5ffff7f6337a.reu",
"排名明细表.b4dab4f2-7b1a-4540-a2d4-65c3e080334e.reu"
};
private static final String RESOURCE_PATH = "/com/fr/report/guide/component";
private static UIHeadMenu fileHeadMenu;
private static NewFormPane newFormPane;
private static int autoInstallComponentCount;
private static String[] autoInstallComponentNames;
public static Guide createGuide() {
GuideScene scene = createScene();
@ -46,9 +53,9 @@ public class UseLayoutAndComponentGuide {
.nextScene(createScene3())
.nextScene(createScene4())
.nextScene(createScene5())
.nextScene(createScene6("box0",0))
.nextScene(createScene6("box1",1))
.nextScene(createScene6("box2",2))
.nextScene(createScene6("box0","25fcd194-d4db-406f-8a08-210f3c262870"))
.nextScene(createScene6("box1","5e17c2eb-5b18-4b6c-854a-5ffff7f6337a"))
.nextScene(createScene6("box2","b4dab4f2-7b1a-4540-a2d4-65c3e080334e"))
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createPreviewClickScene());
@ -57,6 +64,7 @@ public class UseLayoutAndComponentGuide {
.setID(GuideIds.Guide.F001001)
.setName(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Name"))
.setDescription(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Description"))
.setCompleteMessage(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Complete_Message"))
.addScene(scene)
.registerLifecycle(new GuideLifecycleAdaptor() {
@Override
@ -101,8 +109,7 @@ public class UseLayoutAndComponentGuide {
fileHeadMenu.getPopupMenu().setVisible(false);
newFormPane = new NewFormPane();
newFormPane.getWindow().setModal(false);
newFormPane.showWindow();
GuideCreateUtils.showDialogWithoutModal(newFormPane.getWindow());
}
});
return scene;
@ -113,8 +120,16 @@ public class UseLayoutAndComponentGuide {
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
GuideCreateUtils.TIMER.schedule(new TimerTask() {
@Override
public void run() {
scene.addTarget(newFormPane.getWindow());
return true;
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
}, 300);
scene.addTarget(newFormPane.getWindow());
return false;
}
});
return scene;
@ -175,20 +190,20 @@ public class UseLayoutAndComponentGuide {
return scene;
}
public static GuideScene createScene6(String name, int blockIndex) {
public static GuideScene createScene6(String name, String shareID) {
DragScene scene = new DragScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(getXOccupiedLayout(name)), DragScene.DragType.TO);
scene.addDragTarget(getLocalWidgetBlock(blockIndex), DragScene.DragType.FROM);
scene.addDragTarget(getLocalWidgetBlock(shareID), DragScene.DragType.FROM);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_Drag"), GuideTip.Direction.LEFT);
return super.prepared();
}
@Override
public void onComplete() {
LocalWidgetBlock block = getLocalWidgetBlock(blockIndex);
LocalWidgetBlock block = getLocalWidgetBlock(shareID);
XCreator xCreator = block.transformXCreator(block);
XOccupiedLayout xOccupiedLayout = getXOccupiedLayout(name);
GuideCreateUtils.addXCreatorToXLayoutContainer(xCreator, xOccupiedLayout, false);
@ -201,25 +216,22 @@ public class UseLayoutAndComponentGuide {
return (XOccupiedLayout) GuideCreateUtils.getXCreatorFormDesigner(name);
}
private static LocalWidgetBlock getLocalWidgetBlock(int index) {
return (LocalWidgetBlock) ComponentUtils.findComponentsByClass(LocalWidgetRepoPane.getInstance(), LocalWidgetBlock.class).get(index);
private static LocalWidgetBlock getLocalWidgetBlock(String id) {
List<Component> widgetBlockList = ComponentUtils.findComponentsByClass(LocalWidgetRepoPane.getInstance(), LocalWidgetBlock.class);
for (Component component : widgetBlockList) {
LocalWidgetBlock localWidgetBlock = (LocalWidgetBlock) component;
if (StringUtils.equals(localWidgetBlock.getBindInfo().getId(), id)) {
return localWidgetBlock;
}
}
return null;
}
private static void preloadShareComponent() {
autoInstallComponentCount = 3;
try {
DefaultShareGroupManager.getInstance().refresh();
Group shareGroup = DefaultShareGroupManager.getInstance().getGroup(DefaultShareGroup.GROUP_NAME);
if (shareGroup != null) {
DefaultShareGroup defaultShareGroup = (DefaultShareGroup) shareGroup;
int currentWidgetCount = defaultShareGroup.getAllBindInfoList().length;
autoInstallComponentCount = autoInstallComponentCount - (Math.min(autoInstallComponentCount, currentWidgetCount));
}
if (autoInstallComponentCount > 0) {
autoInstallComponentNames = InstallComponentHelper.installPreComponent(autoInstallComponentCount);
InstallComponentHelper.installShareComponents(RESOURCE_PATH, PRE_INSTALL_COMPONENTS);
DefaultShareGroupManager.getInstance().refresh();
LocalWidgetRepoPane.getInstance().refreshAllGroupPane();
}
} catch (Exception e) {
e.printStackTrace();
}
@ -227,15 +239,13 @@ public class UseLayoutAndComponentGuide {
static private void removeAutoInstalledComponent() {
Group shareGroup = DefaultShareGroupManager.getInstance().getGroup(DefaultShareGroup.GROUP_NAME);
if (shareGroup != null && autoInstallComponentNames != null) {
if (shareGroup != null) {
DefaultShareGroup defaultShareGroup = (DefaultShareGroup) shareGroup;
List<String> installedList = new ArrayList<>();
for (String componentName : autoInstallComponentNames) {
if (componentName != null) {
for (String componentName : PRE_INSTALL_COMPONENTS) {
String uuid = componentName.split("\\.")[1];
installedList.add(uuid);
}
}
defaultShareGroup.unInstallSelect(installedList);
LocalWidgetRepoPane.getInstance().refreshAllGroupPane();
}

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

@ -3,7 +3,6 @@ package com.fr.design.mainframe.guide.creator.theme;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.style.FollowingThemePane;
@ -12,13 +11,10 @@ import com.fr.design.mainframe.CenterRegionContainerPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.guide.GuideIds;
import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideBuilder;
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.GuideSceneHelper;
import com.fr.design.mainframe.guide.scene.ClickScene;
@ -30,11 +26,6 @@ import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.mainframe.theme.TemplateThemeBlock;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.design.utils.ComponentUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.teamdev.jxbrowser.internal.ui.ToolkitKey;
import javax.swing.SwingUtilities;
import java.awt.Component;
@ -45,6 +36,7 @@ import java.util.TimerTask;
public class ThemeToggleGuide {
private static TemplateThemeUsingDialog<FormTheme> themeDialog;
private static String TARGET_XCREATOR_NAME = "chart00";
private static String filePath;
public static Guide createGuide() {
@ -54,7 +46,7 @@ public class ThemeToggleGuide {
.nextScene(createScene3())
.nextScene(createScene4())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createSelectXCretorClickScene("chart00"))
.nextScene(GuideSceneHelper.createSelectXCreatorClickScene(TARGET_XCREATOR_NAME))
.nextScene(createScene5())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createPreviewClickScene());
@ -63,6 +55,7 @@ public class ThemeToggleGuide {
.setID(GuideIds.Guide.F002001)
.setName(Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Name"))
.setDescription(Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Description"))
.setCompleteMessage(Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Complete_Message"))
.addScene(scene1)
.registerLifecycle(new GuideLifecycleAdaptor() {
@Override
@ -73,6 +66,7 @@ public class ThemeToggleGuide {
@Override
public void onEnd() {
closeTemplateThemeUsingDialog();
GuideCreateUtils.deleteGuideFile(filePath);
}
})
@ -107,19 +101,15 @@ public class ThemeToggleGuide {
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
new Timer().schedule(new TimerTask() {
GuideCreateUtils.TIMER.schedule(new TimerTask() {
@Override
public void run() {
scene.addTarget(themeDialog);
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
},100);
return true;
}
@Override
public void onComplete() {
},300);
return false;
}
});
@ -139,10 +129,6 @@ public class ThemeToggleGuide {
}
return true;
}
@Override
public void onComplete() {
}
});
return scene;
}
@ -156,6 +142,11 @@ public class ThemeToggleGuide {
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Click_Confirm"), BubbleTip.Direction.TOP);
return true;
}
@Override
public void onComplete() {
GuideCreateUtils.selectXCreatorByWidgetName(TARGET_XCREATOR_NAME);
}
});
return scene;
}
@ -166,7 +157,7 @@ public class ThemeToggleGuide {
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
new Timer().schedule(new TimerTask() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Component target2 = ComponentUtils.findComponentByClass(EastRegionContainerPane.getInstance(), FollowingThemePane.class);
@ -182,10 +173,10 @@ public class ThemeToggleGuide {
0.5f,
0.8f
);
scene.showScene();
}
scene.showScene();
}
},1000);
});
return false;
}
@ -204,7 +195,14 @@ public class ThemeToggleGuide {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
themeDialog = new TemplateThemeUsingDialog<>(designerFrame, DesignerContext.getDesignerFrame().getSelectedJTemplate(), FormThemeConfig.getInstance());
}
themeDialog.setModal(false);
themeDialog.setVisible(true);
GuideCreateUtils.showDialogWithoutModal(themeDialog);
}
private static void closeTemplateThemeUsingDialog() {
if (themeDialog != null) {
themeDialog.setVisible(false);
themeDialog.dispose();
themeDialog = null;
}
}
}

19
designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java

@ -4,13 +4,11 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.mainframe.guide.ui.BubbleHintDialog;
import com.fr.design.mainframe.guide.ui.GuideManageDialog;
import com.fr.general.IOUtils;
import javax.swing.SwingUtilities;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import java.awt.BorderLayout;
@ -47,7 +45,7 @@ public class GuideEntryPane extends BasicPane {
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
GuideManageDialog.getInstance().showDialog();
onClick();
}
});
this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND);
@ -55,13 +53,10 @@ public class GuideEntryPane extends BasicPane {
@Override
public void ancestorAdded(AncestorEvent event) {
if (!GuideCollector.getInstance().isShowHint()) {
BubbleHintDialog dialog = new BubbleHintDialog(DesignerContext.getDesignerFrame());
Point point = new Point(0,0);
SwingUtilities.convertPointToScreen(point, GuideEntryPane.this);
Dimension size = GuideEntryPane.this.getSize();
dialog.setLocationRelativeTo(GuideEntryPane.this);
dialog.setLocation(point.x - 187,point.y + size.height);
dialog.setVisible(true);
BubbleHintDialog dialog = BubbleHintDialog.getInstance();
Point point = getLocationOnScreen();
Dimension size = getSize();
dialog.showDialog(new Point(point.x - 187,point.y + size.height));
}
}
@ -76,4 +71,8 @@ public class GuideEntryPane extends BasicPane {
}
private void onClick() {
GuideManageDialog.getInstance().showDialog();
}
}

Loading…
Cancel
Save