Browse Source

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

* commit 'a3badd5bf61af234a181cdb75cfde59f1cb14fed':
  REPORT-54486 数据集-数据连接中,主机名有\的情况没有适配
  REPORT-54486 数据集-数据连接中,主机名有\的情况没有适配
  REPORT-54155 设计器布局面板上Tab组件拖拽优化 update-调整下方法位置
  CHART-19722 更换了获取数据集字段的方法
  REPORT-54155 设计器布局面板上Tab组件拖拽优化
  CHART-19694 地图标签支持多系列
  REPORT-54529 插件兼容问题
  REPORT-54349 设计器打开模板的启动画面显示中文
  REPORT-54349 设计器打开模板的启动画面显示中文
  REPORT-54454 设置边距时后,封面图边框显示有偏移
feature/big-screen
superman 3 years ago
parent
commit
009442de6e
  1. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  2. 15
      designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java
  3. BIN
      designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png
  4. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  5. 45
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java
  6. 2
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  7. 7
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  8. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  9. 12
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  10. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  11. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  12. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  13. 7
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  14. 4
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  15. 9
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  16. 83
      designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java

4
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -52,8 +52,8 @@ public class JDBCDefPane extends JPanel {
public static final String DRIVER_TYPE = "driver_type"; public static final String DRIVER_TYPE = "driver_type";
public static final String USER_NAME = "user_name"; public static final String USER_NAME = "user_name";
private static final String OTHER_DB = "Others"; private static final String OTHER_DB = "Others";
private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE); private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE); private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$"); private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");
private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]"); private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]");
// 编码转换. // 编码转换.

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -17,9 +18,13 @@ import javax.swing.JPanel;
*/ */
public class OpenLoadingPane extends JPanel { public class OpenLoadingPane extends JPanel {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.gif")); private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/openloading.png"));
private static final Color TIP_COLOR = new Color(108, 174, 235);
private static final int Y_GAP = 50;
private static final int X_GAP = 10;
private UILabel loadingLabel; private UILabel loadingLabel;
private UILabel tipLabel;
public OpenLoadingPane() { public OpenLoadingPane() {
@ -47,7 +52,12 @@ public class OpenLoadingPane extends JPanel {
int loadingLabelHeight = loadingLabel.getPreferredSize().height; int loadingLabelHeight = loadingLabel.getPreferredSize().height;
int loadingLabelX = (width - loadingLabelWidth) / 2; int loadingLabelX = (width - loadingLabelWidth) / 2;
int loadingLabelY = (height - loadingLabelHeight) / 2; int loadingLabelY = (height - loadingLabelHeight) / 2;
int tipLabelWidth = tipLabel.getPreferredSize().width;
int tipLabelHeight = tipLabel.getPreferredSize().height;
int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP;
int tipLabelY = loadingLabelY + loadingLabelHeight - Y_GAP;
loadingLabel.setBounds(loadingLabelX, loadingLabelY, loadingLabelWidth, loadingLabelHeight); loadingLabel.setBounds(loadingLabelX, loadingLabelY, loadingLabelWidth, loadingLabelHeight);
tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight);
} }
@Override @Override
@ -56,7 +66,10 @@ public class OpenLoadingPane extends JPanel {
}); });
setBackground(Color.WHITE); setBackground(Color.WHITE);
loadingLabel = new UILabel(LOADING_ICON); loadingLabel = new UILabel(LOADING_ICON);
tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading"));
tipLabel.setForeground(TIP_COLOR);
add(loadingLabel); add(loadingLabel);
add(tipLabel);
} }
} }

BIN
designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java

@ -7,14 +7,13 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.custom.CustomDefinition; import com.fr.plugin.chart.custom.CustomDefinition;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
@ -28,6 +27,8 @@ import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -117,15 +118,9 @@ public class VanChartRichEditorPane {
return; return;
} }
try { String[] columnNames = DesignTableDataManager.getSelectedColumnNames(tableDataSource, ((NameTableData) tableData).getName());
EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, VanChartRichEditorPane.fieldNames = new ArrayList<>();
tableData, TableData.RESULT_NOT_NEED, false); fieldNames.addAll(Arrays.asList(columnNames));
List<String> fieldNames = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData);
VanChartRichEditorPane.fieldNames = fieldNames;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) { public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) {

45
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java

@ -1,6 +1,9 @@
package com.fr.van.chart.map.designer.style.label; package com.fr.van.chart.map.designer.style.label;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
@ -10,6 +13,7 @@ import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.plugin.chart.type.TextAlign; import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
@ -23,12 +27,17 @@ import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane; import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* Created by Mitisky on 16/5/20. * Created by Mitisky on 16/5/20.
*/ */
public class VanChartMapLabelContentPane extends VanChartLabelContentPane { public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
private UICheckBox showAllSeries;
private JPanel checkPane;
public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) {
super(parent, showOnPane, inCondition); super(parent, showOnPane, inCondition);
} }
@ -55,6 +64,31 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
}; };
} }
protected JPanel getLabelContentPane(JPanel contentPane) {
showAllSeries = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"));
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double p = TableLayout.PREFERRED;
double[] row = {p, p};
Component[][] components = {
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy")), showAllSeries}
};
checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(contentPane, BorderLayout.CENTER);
panel.add(checkPane, BorderLayout.SOUTH);
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), panel);
}
protected void checkCardPane() {
super.checkCardPane();
checkPane.setVisible(getContent().getSelectedIndex() == COMMON_INDEX);
}
protected String[] getRichTextFieldNames() { protected String[] getRichTextFieldNames() {
return new String[]{ return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Area_Name"),
@ -82,4 +116,15 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
content.setRichTextValueFormat(new AttrTooltipMapValueFormat()); content.setRichTextValueFormat(new AttrTooltipMapValueFormat());
return content; return content;
} }
public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = super.updateBean();
attrTooltipContent.setShowAllSeries(showAllSeries.isSelected());
return attrTooltipContent;
}
public void populateBean(AttrTooltipContent attrTooltipContent) {
super.populateBean(attrTooltipContent);
showAllSeries.setSelected(attrTooltipContent.isShowAllSeries());
}
} }

2
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -72,7 +72,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
} }
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout();
if(topLayout != null){ if(topLayout != null){
if (topLayout.isEditable()){ if (topLayout.isDragInAble() || topLayout.isEditable()){
return topLayoutAccept(creator, x, y); return topLayoutAccept(creator, x, y);
} }
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局 //绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局

7
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -19,12 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutConstraints;
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
@ -169,7 +164,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//布局控件要先判断是不是可编辑 //布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp); boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
if (access) { if (access) {
return false; return false;
} }

2
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -255,7 +255,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* @param e 鼠标点击事件 * @param e 鼠标点击事件
*/ */
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) {
if (this.isShareConfigButtonFocus()) { if (this.isHelpBtnOnFocus()) {
CoverReportPane.showShareConfig(((XCreator) this.getParent()).toData()); CoverReportPane.showShareConfig(((XCreator) this.getParent()).toData());
return; return;
} }

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

@ -67,7 +67,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
private int[] directions; private int[] directions;
private Rectangle backupBound; private Rectangle backupBound;
private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性 private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性
private boolean isShareConfigButtonFocus = false;//焦点是否在帮助按钮上 private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上
private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置
public XCreator(Widget ob, Dimension initSize) { public XCreator(Widget ob, Dimension initSize) {
@ -671,12 +671,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 焦点是否在帮助按钮上 * 焦点是否在帮助按钮上
* @return 焦点是否在帮助按钮上 * @return 焦点是否在帮助按钮上
*/ */
public boolean isShareConfigButtonFocus() { public boolean isHelpBtnOnFocus() {
return isShareConfigButtonFocus; return isHelpBtnOnFocus;
} }
public void setShareConfigButtonFocus(boolean shareConfigButtonFocus) { public void setHelpBtnOnFocus(boolean isHelpBtnOnFocus) {
isShareConfigButtonFocus = shareConfigButtonFocus; this.isHelpBtnOnFocus = isHelpBtnOnFocus;
} }
@ -692,7 +692,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (coverPanel != null) { if (coverPanel != null) {
coverPanel.setVisible(display); coverPanel.setVisible(display);
coverPanel.setPreferredSize(editor.getPreferredSize()); coverPanel.setPreferredSize(editor.getPreferredSize());
coverPanel.setBounds(editor.getBounds()); coverPanel.setBounds(new Rectangle(0, 0 , editor.getWidth(), editor.getHeight()));
editor.repaint(); editor.repaint();
} }
} }

2
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -306,7 +306,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) {
super.respondClick(editingMouseListener, e); super.respondClick(editingMouseListener, e);
editingMouseListener.refreshTopXCreator(); editingMouseListener.refreshTopXCreator();
if (this.isShareConfigButtonFocus()) { if (this.isHelpBtnOnFocus()) {
CoverReportPane.showShareConfig(((XCreator) this.getParent()).toData()); CoverReportPane.showShareConfig(((XCreator) this.getParent()).toData());
} else { } else {
switchTab(e, editingMouseListener); switchTab(e, editingMouseListener);

9
designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java

@ -48,6 +48,8 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
//鼠标移动到布局画出编辑层 //鼠标移动到布局画出编辑层
protected boolean isMouseEnter = false; protected boolean isMouseEnter = false;
private volatile boolean dragInAble;
public void setMouseEnter(boolean mouseEnter) { public void setMouseEnter(boolean mouseEnter) {
isMouseEnter = mouseEnter; isMouseEnter = mouseEnter;
} }
@ -577,4 +579,11 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
return false; return false;
} }
public boolean isDragInAble() {
return dragInAble;
}
public void setDragInAble(boolean dragInAble) {
this.dragInAble = dragInAble;
}
} }

2
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -467,7 +467,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
* @param e 鼠标点击事件 * @param e 鼠标点击事件
*/ */
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) {
if (this.isShareConfigButtonFocus()) { if (this.isHelpBtnOnFocus()) {
CoverReportPane.showShareConfig(this.toData()); CoverReportPane.showShareConfig(this.toData());
return; return;
} }

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

@ -358,7 +358,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
*/ */
@Override @Override
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){
if (this.isShareConfigButtonFocus()) { if (this.isHelpBtnOnFocus()) {
CoverReportPane.showShareConfig(this.toData()); CoverReportPane.showShareConfig(this.toData());
return; return;
} }
@ -447,4 +447,9 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
return true; return true;
} }
@Override
public Dimension initEditorSize() {
return LARGEPREFERREDSIZE;
}
} }

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

@ -435,7 +435,7 @@ public class EditingMouseListener extends MouseInputAdapter {
} }
private void processCoverMouseMove(XCreator component, MouseEvent e) { private void processCoverMouseMove(XCreator component, MouseEvent e) {
component.setShareConfigButtonFocus(false); component.setHelpBtnOnFocus(false);
Insets insets; Insets insets;
if (component instanceof XBorderStyleWidgetCreator) { if (component instanceof XBorderStyleWidgetCreator) {
insets = ((XBorderStyleWidgetCreator) component).getInsets(); insets = ((XBorderStyleWidgetCreator) component).getInsets();
@ -447,7 +447,7 @@ public class EditingMouseListener extends MouseInputAdapter {
} }
if (isShareConfigButton(e, component, insets)) { if (isShareConfigButton(e, component, insets)) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
component.setShareConfigButtonFocus(true); component.setHelpBtnOnFocus(true);
} else if (isEditButton(e, component, insets)) { } else if (isEditButton(e, component, insets)) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }

9
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -66,6 +66,8 @@ public class FormCreatorDropTarget extends DropTarget {
private AddingModel addingModel; private AddingModel addingModel;
private static final int GAP = 30; private static final int GAP = 30;
private TabDragInner tabDragInner;
private JWindow promptWindow = new JWindow(); private JWindow promptWindow = new JWindow();
private UIButton promptButton = new UIButton("", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); private UIButton promptButton = new UIButton("", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH));
@ -73,6 +75,7 @@ public class FormCreatorDropTarget extends DropTarget {
this.designer = designer; this.designer = designer;
this.addingModel = designer.getAddingModel(); this.addingModel = designer.getAddingModel();
this.promptWindow.add(promptButton); this.promptWindow.add(promptButton);
this.tabDragInner = new TabDragInner(designer);
} }
private void adding(int x, int y) { private void adding(int x, int y) {
@ -128,6 +131,7 @@ public class FormCreatorDropTarget extends DropTarget {
designer.getSelectionModel().setSelectedCreators( designer.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget}));
designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED);
tabDragInner.tryDragIn();
} else { } else {
Toolkit.getDefaultToolkit().beep(); Toolkit.getDefaultToolkit().beep();
} }
@ -263,7 +267,10 @@ public class FormCreatorDropTarget extends DropTarget {
@Override @Override
public synchronized void dragOver(DropTargetDragEvent dtde) { public synchronized void dragOver(DropTargetDragEvent dtde) {
Point loc = dtde.getLocation(); Point loc = dtde.getLocation();
hovering(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); int x = designer.getRelativeX(loc.x);
int y = designer.getRelativeY(loc.y);
hovering(x, y);
tabDragInner.canDragIn(designer.getComponentAt(x, y), x, y);
} }
/** /**

83
designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java

@ -0,0 +1,83 @@
package com.fr.design.mainframe;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
/**
* 判断tab块是否能拖入
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/29
*/
public class TabDragInner {
/**
* 悬浮停留的时间间隔
*/
private static final long TIME_GAP = 1000;
private FormDesigner designer;
private XLayoutContainer belowXLayoutContainer;
private long timer;
private int oldX;
private int oldY;
public TabDragInner(FormDesigner designer) {
this.designer = designer;
}
/**
* 判断拖入
*
* @param creator 当前拖拽的组件下方所在布局最上层的组件
* @param x
* @param y
*/
public void canDragIn(XCreator creator, int x, int y) {
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(creator).getTopLayout();
boolean dragInAble = false;
if (topLayout != null && topLayout.acceptType(XWCardMainBorderLayout.class) && belowXLayoutContainer == null) {
belowXLayoutContainer = topLayout;
timer = System.currentTimeMillis();
} else if (topLayout == belowXLayoutContainer && topLayout != null && oldX == x && oldY == y) {
if (System.currentTimeMillis() - timer > TIME_GAP) {
dragInAble = true;
}
} else {
timer = 0;
belowXLayoutContainer = null;
}
if (topLayout != null) {
topLayout.setDragInAble(dragInAble);
}
oldX = x;
oldY = y;
}
/**
* 尝试进入tab编辑
*/
public void tryDragIn() {
if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) {
EditingMouseListener editingMouseListener = new EditingMouseListener(designer);
editingMouseListener.refreshTopXCreator();
belowXLayoutContainer.setEditable(true);
if (editingMouseListener.stopEditing() && belowXLayoutContainer != designer.getRootComponent()) {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer);
if (adapter != null) {
editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter);
}
}
}
}
public XLayoutContainer getBelowXLayoutContainer() {
return belowXLayoutContainer;
}
}
Loading…
Cancel
Save