Browse Source

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

* commit 'fc749b3b82cdd3b98639b734545f395e595b6207':
  CHART-20211 面板间距调整
  REPORT-54891 【10.0.19】自定义导出按钮
  REPORT-54640 - 【10.0.19】设计器埋点重构剥离二期
  REPORT-54885 布局优化 门槛用例没通过的bug
feature/big-screen
superman 3 years ago
parent
commit
61601b6ef1
  1. 453
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  3. 14
      designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java
  4. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  5. 4
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  6. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  7. 3
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  8. 65
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  9. 22
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java
  10. 2
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java
  11. 16
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  12. 13
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

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

@ -0,0 +1,453 @@
package com.fr.design.javascript;
import com.fr.base.BaseFormula;
import com.fr.base.Parameter;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.scrollruler.ModLineBorder;
import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.general.GeneralUtils;
import com.fr.js.ExportJavaScript;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript> {
private ExportRadioGroup templateRadioGroup;
private UIRadioButton currentTemplateRadio;
private UIRadioButton otherTemplateRadio;
private UITextField reportPathTextField;
private UIButton browserButton;
private UIComboBox exportTypeComboBox;
private ExportRadioGroup fileNameRadioGroup;
private UIRadioButton defaultNameRadio;
private UIRadioButton customNameRadio;
private FormulaEditor fileNameFormulaEditor;
private UICheckBox extendParametersCheckBox;
private ReportletParameterViewPane parameterViewPane;
private static final double p = TableLayout.PREFERRED;
private static final Map<String, String> EXPORT_TYPES_MAP = new HashMap<>();
private static final String CURRENT_TEMPLATE = "current";
private static final String DEFAULT_FILENAME = "default";
static {
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_PDF, Toolkit.i18nText("Fine-Design_Basic_Export_JS_PDF"));
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_EXCEL_PAGE, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Excel_Page"));
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_EXCEL_SIMPLE, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Excel_Simple"));
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_EXCEL_SHEET, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Excel_Sheet"));
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_WORD, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Word"));
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_IMAGE, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Image"));
}
public ExportJavaScriptPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting")));
//导出模板+导出方式+导出文件名
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
//导出模板
JPanel chooseTemplatePane = initChooseTemplatePane();
northPane.add(chooseTemplatePane, BorderLayout.NORTH);
//导出方式
JPanel exportTypePane = initExportTypePane();
northPane.add(exportTypePane, BorderLayout.CENTER);
//导出文件名
JPanel fileNamePane = initFileNamePane();
northPane.add(fileNamePane, BorderLayout.SOUTH);
//参数
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel paramsPane = initParamsPane();
centerPane.add(paramsPane);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
}
private JPanel initParamsPane() {
extendParametersCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Extends_Report_Parameters"));
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane.addTableEditorListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
List<ParameterProvider> list = parameterViewPane.update();
HashSet<String> tempSet = new HashSet<>();
for (int i = 0; i < list.size(); i++) {
if (StringUtils.isEmpty(list.get(i).getName())) {
continue;
}
if (tempSet.contains(list.get(i).toString())) {
list.remove(i);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!");
return;
}
tempSet.add(list.get(i).toString());
}
}
});
extendParametersCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
parameterViewPane.setVisible(e.getStateChange() == ItemEvent.DESELECTED);
}
});
JPanel paramsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
paramsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Toolkit.i18nText("Fine-Design_Basic_Parameters")));
paramsPane.add(extendParametersCheckBox, BorderLayout.NORTH);
JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
dynamicPaneWrapper.add(parameterViewPane);
paramsPane.add(dynamicPaneWrapper, BorderLayout.CENTER);
return paramsPane;
}
private JPanel initFileNamePane() {
UILabel nameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename") + ":");
fileNameRadioGroup = new ExportRadioGroup();
defaultNameRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Default"));
defaultNameRadio.setSelected(true);
customNameRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Custom"));
addRadioToGroup(fileNameRadioGroup, defaultNameRadio, customNameRadio);
fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"));
fileNameRadioGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (defaultNameRadio.isSelected()) {
fileNameFormulaEditor.setEnabled(false);
} else {
fileNameFormulaEditor.setEnabled(true);
}
}
});
Component[][] components = new Component[][]{{nameLabel, defaultNameRadio, customNameRadio, fileNameFormulaEditor}};
JPanel fileNameRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p, p});
JPanel fileNameTipPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel fileNameTipLabel = new UILabel("<html><body style=\"color:red\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>");
fileNameTipPane.add(fileNameTipLabel);
JPanel fileNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
fileNamePane.add(fileNameRadioPane, BorderLayout.NORTH);
fileNamePane.add(fileNameTipPane, BorderLayout.CENTER);
fileNameTipPane.setBorder(BorderFactory.createEmptyBorder(5,2,5,2));
fileNamePane.setBorder(BorderFactory.createEmptyBorder(5,2,5,2));
return fileNamePane;
}
private JPanel initExportTypePane() {
UILabel typeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type") + ":");
exportTypeComboBox = new UIComboBox(new DefaultComboBoxModel<String>());
DefaultComboBoxModel<String> comboBoxModel = (DefaultComboBoxModel<String>) exportTypeComboBox.getModel();
String[] allExportTypes = new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE};
for (int i = 0; i < allExportTypes.length; i++) {
comboBoxModel.addElement(allExportTypes[i]);
}
this.exportTypeComboBox.setRenderer(new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof String) {
this.setText(EXPORT_TYPES_MAP.get(value));
}
return this;
}
});
Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}};
JPanel exportTypePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p});
exportTypePane.setBorder(BorderFactory.createEmptyBorder(5,2,5,2));
return exportTypePane;
}
private JPanel initChooseTemplatePane() {
UILabel templateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template") + ":");
templateRadioGroup = new ExportRadioGroup();
currentTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current"));
currentTemplateRadio.setSelected(true);
otherTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"));
addRadioToGroup(templateRadioGroup, currentTemplateRadio, otherTemplateRadio);
templateRadioGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (currentTemplateRadio.isSelected()) {
reportPathTextField.setEnabled(false);
browserButton.setEnabled(false);
} else {
reportPathTextField.setEnabled(true);
browserButton.setEnabled(true);
}
}
});
Component[][] components = new Component[][]{{templateLabel, currentTemplateRadio, otherTemplateRadio}};
JPanel reportletRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p});
JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// 路径输入框
reportPathTextField = new UITextField(20);
reportletNamePane.add(reportPathTextField, BorderLayout.CENTER);
// 选择路径按钮
browserButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Select"));
browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20));
reportletNamePane.add(browserButton, BorderLayout.EAST);
browserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
final ReportletPane reportletPane = new ReportletPane();
reportletPane.setSelectedReportletPath(reportPathTextField.getText());
BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ExportJavaScriptPane.this));
reportletDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
reportPathTextField.setText(reportletPane.getSelectedReportletPath());
}
});
reportletDialog.setVisible(true);
}
});
JPanel chooseTemplatePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
chooseTemplatePane.add(reportletRadioPane, BorderLayout.NORTH);
chooseTemplatePane.add(reportletNamePane, BorderLayout.CENTER);
chooseTemplatePane.setBorder(BorderFactory.createEmptyBorder(0,2,5,2));
return chooseTemplatePane;
}
@Override
public void populateBean(ExportJavaScript ob) {
if (ob == null) {
ob = new ExportJavaScript();
}
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1);
if (ob.isCurrentTemplate()) {
this.reportPathTextField.setEnabled(false);
this.browserButton.setEnabled(false);
} else {
this.reportPathTextField.setEnabled(true);
this.browserButton.setEnabled(true);
this.reportPathTextField.setText(ob.getTemplatePath());
}
this.exportTypeComboBox.setSelectedItem(ob.getExportType());
this.fileNameRadioGroup.selectIndexButton(ob.isDefaultFileName() ? 0 : 1);
if (ob.isDefaultFileName()) {
this.fileNameFormulaEditor.setEnabled(false);
} else {
this.fileNameFormulaEditor.setEnabled(true);
this.fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(ob.getFileName()));
}
if (ob.isExtendParameters()) {
this.extendParametersCheckBox.setSelected(true);
} else {
this.extendParametersCheckBox.setSelected(false);
List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
ParameterProvider[] parameters = ob.getParameters();
this.parameterViewPane.populate(parameters);
}
}
@Override
public ExportJavaScript updateBean() {
ExportJavaScript exportJavaScript = new ExportJavaScript();
updateBean(exportJavaScript);
return exportJavaScript;
}
@Override
public void updateBean(ExportJavaScript exportJavaScript) {
exportJavaScript.setCurrentTemplate(this.currentTemplateRadio.isSelected());
exportJavaScript.setTemplatePath(getTemplatePath());
exportJavaScript.setExportType(GeneralUtils.objectToString(this.exportTypeComboBox.getSelectedItem()));
exportJavaScript.setDefaultFileName(this.defaultNameRadio.isSelected());
exportJavaScript.setFileName(getFileName());
exportJavaScript.setExtendParameters(this.extendParametersCheckBox.isSelected());
if (extendParametersCheckBox.isSelected()) {
exportJavaScript.setParameters(null);
} else {
List<ParameterProvider> parameterList = this.parameterViewPane.update();
if (!parameterList.isEmpty()) {
Parameter[] parameters = new Parameter[parameterList.size()];
parameterList.toArray(parameters);
exportJavaScript.setParameters(parameters);
}
}
}
private String getTemplatePath() {
return currentTemplateRadio.isSelected() ? CURRENT_TEMPLATE : reportPathTextField.getText();
}
private String getFileName() {
return defaultNameRadio.isSelected() ? DEFAULT_FILENAME : fileNameFormulaEditor.getUITextField().getText();
}
@Override
public boolean accept(Object ob) {
return ob instanceof ExportJavaScript;
}
@Override
public void reset() {
populateBean(null);
}
@Override
public java.lang.String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Event");
}
private void addRadioToGroup(ButtonGroup buttonGroup, UIRadioButton... radios) {
for (UIRadioButton radio : radios) {
buttonGroup.add(radio);
}
}
class ExportRadioGroup extends ButtonGroup {
private List<UIRadioButton> radioButtons = new ArrayList<>();
@Override
public void add(AbstractButton button) {
super.add(button);
UIRadioButton radioButton = (UIRadioButton) button;
radioButtons.add(radioButton);
}
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
}
class ReportletPane extends BasicPane {
private TemplateFileTree templateReportletTree;
private JScrollPane t_panel;
private JPanel cardPane;
public ReportletPane() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(centerPane, BorderLayout.CENTER);
cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
centerPane.add(cardPane, BorderLayout.CENTER);
cardPane.setLayout(new CardLayout());
templateReportletTree = new TemplateFileTree();
IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt"});
templateReportletTree.setFileNodeFilter(filter);
cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE");
this.refreshEnv();
}
/**
* 检查是否符合规范
*
* @throws Exception 抛错
*/
@Override
public void checkValid() throws Exception {
String path = this.getSelectedReportletPath();
if (path == null) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Selected_File_Cannot_Be_Null"));
}
}
/**
* 刷新Env
*/
public void refreshEnv() {
this.templateReportletTree.refreshEnv();
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Event");
}
/*
* 返回选中的Reportlet的路径
*/
public String getSelectedReportletPath() {
if (t_panel.isVisible()) {
return templateReportletTree.getSelectedTemplatePath();
}
return null;
}
/*
* 选中某Reportlet
*/
public void setSelectedReportletPath(String reportletPath) {
if (reportletPath == null) {
return;
}
templateReportletTree.setSelectedTemplatePath(reportletPath);
}
}
}

4
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -44,6 +44,10 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
contentDBManiPane.add(createDBManipulationPane());
paneList.add(new Commit2DBJavaScriptPane(this, contentDBManiPane));
paneList.add(initEmaiPane());
boolean workbook = DesignerContext.getDesignerFrame().getSelectedJTemplate().isJWorkBook();
if (workbook) {
paneList.add(new ExportJavaScriptPane());
}
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) {
for (JavaScriptActionProvider jsp : javaScriptActionProviders) {

14
designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java

@ -25,6 +25,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
private long lastGuidePopUpTime = 0;
private String historyCreatedReuses = "[]";
public long getLastNotifyTime() {
return lastNotifyTime;
}
@ -62,12 +64,21 @@ public class ComponentReuseNotificationInfo implements XMLable {
DesignerEnvManager.getEnvManager().saveXMLFile();
}
public String getHistoryCreatedReuses() {
return historyCreatedReuses;
}
public void setHistoryCreatedReuses(String historyCreatedReuses) {
this.historyCreatedReuses = historyCreatedReuses;
}
@Override
public void readXML(XMLableReader reader) {
this.setLastNotifyTime(reader.getAttrAsLong("lastNotifyTime", 0L));
this.setNotifiedNumber(reader.getAttrAsInt("notifiedNumber", 0));
this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false));
this.setLastGuidePopUpTime(reader.getAttrAsLong("lastGuidePopUpTime", 0L));
this.setHistoryCreatedReuses(reader.getAttrAsString("historyCreatedReuses", "[]"));
}
@Override
@ -76,7 +87,8 @@ public class ComponentReuseNotificationInfo implements XMLable {
writer.attr("lastNotifyTime", this.lastNotifyTime)
.attr("notifiedNumber", this.notifiedNumber)
.attr("clickedWidgetLib", this.clickedWidgetLib)
.attr("lastGuidePopUpTime", this.lastGuidePopUpTime);
.attr("lastGuidePopUpTime", this.lastGuidePopUpTime)
.attr("historyCreatedReuses", this.historyCreatedReuses);;
writer.end();
}

10
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java

@ -277,11 +277,11 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
*/
public Dimension getPreferredSize() {
if (designTypeButtonGroup.getSelectedIndex() == 0) {
return new Dimension(colorGroup.getPreferredSize().width + textGroup.getPreferredSize().width, upControlPane.getPreferredSize().height + getBoundY());
return new Dimension(colorGroup.getPreferredSize().width + textGroup.getPreferredSize().width, upControlPane.getPreferredSize().height + getPreferredMarginY());
} else {
int extra = stagePanel == null ? 0 : stagePanel.getPreferredSize().height + getBoundY();
int extra = stagePanel == null ? 0 : stagePanel.getPreferredSize().height + getPreferredMarginY();
return new Dimension(colorGroup.getPreferredSize().width + textGroup.getPreferredSize().width,
extra + textGroup.getPreferredSize().height + upControlPane.getPreferredSize().height + OFF_HEIGHT + getBoundY());
extra + textGroup.getPreferredSize().height + upControlPane.getPreferredSize().height + OFF_HEIGHT + getPreferredMarginY());
}
}
@ -662,6 +662,10 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
return UPCONTROLPANE_WIDTH;
}
protected int getPreferredMarginY() {
return MARGIN_TOP;
}
/**
*刷新颜色选取器
* @param colorArray 颜色值

4
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -132,6 +132,10 @@ public class VanChartGaugeSeriesPane extends VanChartMultiColorSeriesPane {
return 10;
}
protected int getPreferredMarginY() {
return 10;
}
protected double getDescriptionWidth() {
double descriptionWidth = super.getDescriptionWidth();
if (valueFillStylePane == null) {

7
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -865,4 +865,11 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public boolean isParentAbsolute() {
return ((XCreator) this.getParent()).acceptType(XWAbsoluteLayout.class);
}
public int getLevel() {
if (this.getParent() == null) {
return 1;
}
return ((XCreator) this.getParent()).getLevel() + 1;
}
}

3
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -318,6 +318,8 @@ public class EditingMouseListener extends MouseInputAdapter {
offsetEventPoint(e);
XCreator component = designer.getComponentAt(e);
designer.getSpacingLineDrawer().updateMouseEvent(e, true);
setCoverPaneNotDisplay(component, e, false);
if (processTopLayoutMouseMove(component, e)) {
@ -353,7 +355,6 @@ public class EditingMouseListener extends MouseInputAdapter {
return;
}
designer.getSpacingLineDrawer().updateMouseEvent(e, true);
processChartEditorMouseMove(component, e);
e.translatePoint(oldX - e.getX(), oldY - e.getY());
designer.repaint();

65
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -835,6 +835,38 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return null;
}
/**
* 从root里面查找层级为level的控件
*/
private XCreator xCreatorAt(int x, int y, XCreator root, int level) {
if (root == null || !root.isVisible()) {
return null;
}
x -= root.getX();
y -= root.getY();
if (root instanceof XLayoutContainer) {
XLayoutContainer rootContainer = (XLayoutContainer) root;
int count = rootContainer.getXCreatorCount();
for (int i = 0; i < count; i++) {
XCreator child = rootContainer.getXCreator(i);
XCreator dest = xCreatorAt(x, y, child, level);
if (dest != null && dest.getLevel() == level) {
return dest;
}
}
}
Rectangle rect = ComponentUtils.computeVisibleRect(root);
if (isIntersectArea(x, y, rect)) {
// 判断是否处于交叉区域
return root;
}
return null;
}
/**
* 从已选择的组件中找x,y所在的组件
*/
@ -1095,25 +1127,38 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* */
@Override
public XCreator getComponentAt(int x, int y) {
XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent;
if (container == null) {
container = rootComponent;
}
int relativeX = x + (int) (formArea.getHorizontalValue() / scale) - container.getX();
int relativeY = y + (int) (formArea.getVerticalValue() / scale) - container.getY();
XCreator result = xCreatorAt(relativeX, relativeY, container);
XLayoutContainer container = getRootContainer(y);
XCreator result = xCreatorAt(getRelativeScaleX(x) - container.getX(), getRelativeScaleY(y) - container.getY(), container);
return result == null ? getComponentAt(x, y, null) : result;
}
@Nullable
public XCreator getComponentAt(int x, int y, XCreator[] except) {
XLayoutContainer container = getRootContainer(y);
XCreator comp = xCreatorAt(getRelativeScaleX(x), getRelativeScaleY(y), container, except);
return comp == null ? container : comp;
}
public XCreator getComponentAt(int x, int y, int level) {
XLayoutContainer container = getRootContainer(y);
XCreator comp = xCreatorAt(getRelativeScaleX(x), getRelativeScaleY(y), container, level);
return comp == null ? container : comp;
}
private XLayoutContainer getRootContainer(int y) {
XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent;
if (container == null) {
container = rootComponent;
}
XCreator comp = xCreatorAt(x + (int)(formArea.getHorizontalValue()/scale), (int)(y + formArea.getVerticalValue()/scale), container,
except);
return comp == null ? container : comp;
return container;
}
private int getRelativeScaleX(int x) {
return x + (int)(formArea.getHorizontalValue() / scale);
}
private int getRelativeScaleY(int y) {
return y + (int)(formArea.getVerticalValue() / scale);
}
public SelectionModel getSelectionModel() {

22
designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

@ -21,7 +21,7 @@ public class FormSpacingLineDrawer {
private static final int MIN_SPACING = 10;
private FormDesigner designer;
private XCreator hoverCreator;
private XCreator hoverCreator = null;
private Rectangle selectedRec;
private boolean isMouseMoveEvent = false;
@ -30,7 +30,10 @@ public class FormSpacingLineDrawer {
}
public void updateMouseEvent(MouseEvent e, boolean isMouseMoveEvent) {
this.hoverCreator = designer.getComponentAt(e);
XCreator creator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (creator != null) {
this.hoverCreator = designer.getComponentAt(e.getX(), e.getY(), creator.getLevel());
}
this.isMouseMoveEvent = isMouseMoveEvent;
}
@ -131,14 +134,6 @@ public class FormSpacingLineDrawer {
designer.getSelectionModel().getSelection().getSelectedCreator().getParent() == null;
}
private boolean isHoveredRootComponent() {
return designer.isRoot(hoverCreator);
}
private boolean isHoveredForm() {
return hoverCreator.getParent() == null;
}
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) {
return nearestSides[0].isVerticalCenterLineBeforeTheParallelLine(nearestSides[1]) || nearestSides[0].isVerticalCenterLineBehindTheParallelLine(nearestSides[1]);
}
@ -147,12 +142,13 @@ public class FormSpacingLineDrawer {
return isSelectedForm() || isSelectedRootComponent();
}
private boolean isHoveredRootPane() {
return isHoveredForm() || isHoveredRootComponent();
private boolean isSelectedCreatorSameParentWithHoveredCreator() {
XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
return selectedCreator != null && hoverCreator != null && selectedCreator.getParent() == hoverCreator.getParent();
}
private boolean isDrawSpacingLine() {
return !isSelectedRootPane() && !isHoveredRootPane() && isMouseMoveEvent;
return !isSelectedRootPane() && isSelectedCreatorSameParentWithHoveredCreator() && isMouseMoveEvent;
}
private AbstractFormParallelLine[] getNearestHorizontalSide() {

2
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

@ -32,10 +32,10 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
public FormMultiWidgetCardPane(FormDesigner designer) {
super(designer);
arrangement = new MultiSelectionArrangement(designer);
}
public void initPropertyPane() {
arrangement = new MultiSelectionArrangement(designer);
content.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
content.add(createArrangementLayoutPane(), BorderLayout.CENTER);
}

16
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -25,6 +25,7 @@ import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@ -39,6 +40,7 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
private static final String DBCOMMIT = Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
private static final String CUSTOMACTION = Toolkit.i18nText("Fine-Design_Report_Submit_Type_Custom");
private static final String EMAIL = Toolkit.i18nText("Fine-Design_Report_Email_Sent_Email");
private static final String EXPORT = Toolkit.i18nText("Fine-Design_Basic_Export_JS_Event");
private Listener listener;
@ -62,8 +64,12 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
nameText = new UITextField(8);
nameText.setEditable(false);
namePane.add(nameText, BorderLayout.WEST);
final String[] style = {JS, DBCOMMIT, CUSTOMACTION, EMAIL};
styleBox = new UIComboBox(style);
final List<String> style = new ArrayList<>(Arrays.asList(JS, DBCOMMIT, CUSTOMACTION, EMAIL));
boolean workbook = DesignerContext.getDesignerFrame().getSelectedJTemplate().isJWorkBook();
if (workbook) {
style.add(EXPORT);
}
styleBox = new UIComboBox(style.toArray());
namePane.add(styleBox);
namePane = GUICoreUtils.createFlowPane(new Component[]{
new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"),
@ -90,6 +96,12 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
// 发送邮件
EmailPane emailPane = new EmailPane();
hyperlinkPane.add(EMAIL, emailPane);
// 导出事件
if (workbook) {
ExportJavaScriptPane exportJavaScriptPane = new ExportJavaScriptPane();
hyperlinkPane.add(EXPORT, exportJavaScriptPane);
cards.add(exportJavaScriptPane);
}
cards.add(javaScriptPane);
cards.add(commit2DBJavaScriptPane);
cards.add(customActionPane);

13
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

@ -20,6 +20,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.constants.ComponentType;
import com.fr.design.mainframe.share.constants.ComponentTypes;
import com.fr.design.mainframe.share.constants.DisplayDevice;
@ -36,6 +37,9 @@ import com.fr.form.share.bean.StyleThemeBean;
import com.fr.form.share.constants.ShareComponentConstants;
import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.form.share.Group;
import com.fr.json.JSON;
import com.fr.json.JSONArray;
import com.fr.json.JSONFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.manage.PluginManager;
@ -622,6 +626,15 @@ public class ShareMainPane extends JPanel {
provider.setDesignerVersion(ProductConstants.VERSION);
provider.setVendor(loginLabel.getText());
provider.setFileName(provider.getNameWithID());
provider.setVendorUid(DesignerEnvManager.getEnvManager().getDesignerLoginUid());
provider.setCreateTime(System.currentTimeMillis());
JSONArray historyCreatedReuses = JSONFactory.createJSON(
JSON.ARRAY,
ComponentReuseNotificationInfo.getInstance().getHistoryCreatedReuses()
);
historyCreatedReuses.add(uuid);
ComponentReuseNotificationInfo.getInstance().setHistoryCreatedReuses(historyCreatedReuses.toString());
DesignerEnvManager.getEnvManager().saveXMLFile();
if (upload) {
provider.setSummary(content.getText());

Loading…
Cancel
Save