Browse Source

Merge pull request #4914 in DESIGN/design from feature/10.0 to research/10.0

* commit '717b4dd4981c45c38d441e5e3120b38137069adb':
  REPORT-53175【10.0.18】组件背景分离为标题/背景/边框
  REPORT-55090【组件背景分离】组件复用-标题图案的图片预览图,和交互文档里定的悬浮时出现删除按钮和不透明遮罩预期效果不同
  REPORT-55071 【组件背景分离】组件复用-标题填充选择渐变色时,设置面板出现纵向滚动条,遮挡住了渐变色右侧颜色选择按钮
  REPORT-55089 组件背景分离】组件复用-现在锁按钮在宽高值之间,锁定时,拖拽调整组件大小时,宽度值会变化成一个很长的小数
  CHART-19824 图表切换面板交互修改
  REPORT-53175【10.0.18】组件背景分离为标题/背景/边框
  REPORT-54392 释放最近打开表单对象内存实现方式变更
  REPORT-53949 UISpinner获取焦点后才可以滚动调整值
research/10.0
superman 3 years ago
parent
commit
96a3d9462b
  1. 5
      designer-base/src/main/java/com/fr/design/file/Releasable.java
  2. 9
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  3. 7
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java
  4. 148
      designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java
  5. 16
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  6. 25
      designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java
  7. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  8. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  9. 9
      designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java
  10. 18
      designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java
  11. 14
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java
  12. 71
      designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java
  13. 12
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  14. 8
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  15. 46
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  16. 28
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  17. 7
      designer-form/src/main/java/com/fr/design/mainframe/XCreateGather.java
  18. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  19. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  20. 4
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

5
designer-base/src/main/java/com/fr/design/file/Releasable.java

@ -1,5 +0,0 @@
package com.fr.design.file;
public interface Releasable {
void releaseResources();
}

9
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -58,6 +58,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
* Spinner内的数字文本框长度 * Spinner内的数字文本框长度
*/ */
private int numberFieldColumns; private int numberFieldColumns;
private boolean hasTextFieldFocus = false;
public UISpinner() { public UISpinner() {
@ -318,7 +319,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { if (hasTextFieldFocus && isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
setValue(value - e.getWheelRotation()); setValue(value - e.getWheelRotation());
} }
} }
@ -330,8 +331,14 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
textField.getDocument().removeDocumentListener(docListener); textField.getDocument().removeDocumentListener(docListener);
textField.getDocument().addDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener);
textField.addFocusListener(new FocusAdapter() { textField.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
hasTextFieldFocus = true;
}
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
hasTextFieldFocus = false;
textField.getDocument().removeDocumentListener(docListener); textField.getDocument().removeDocumentListener(docListener);
textField.setValue(value); textField.setValue(value);
textField.getDocument().addDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener);

7
designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java

@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() { gradientPane.registerChangeListener(new UIObserverListener() {
@Override @Override
public void doChange() { public void doChange() {
@ -68,4 +68,9 @@ public class BackgroundSpecialPane extends BackgroundPane{
return kinds.toArray(new BackgroundQuickPane[kinds.size()]); return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
} }
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() {
// 使用默认的150宽度构建渐变条
return new GradientBackgroundQuickPane();
}
} }

148
designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java vendored

@ -0,0 +1,148 @@
package com.fr.env.utils;
import com.fr.common.annotations.Compatible;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
/**
* @author Starryi
* @version 10.0.18
* Created by Starryi on 2021/7/7
* 设计器访问和获取关键历史交互信息的持久化工具该关键历史交互信息
* 如用户是否点击过某按钮是否查看过某弹窗信息上次选择过的文件所在目录等
*/
@Compatible
public class DesignerInteractionHistory implements XMLReadable, XMLWriter {
private static final String FILE_NAME = "designer.ix.history.info";
private static final String ROOT_TAG = "History";
private static DesignerInteractionHistory history;
public static DesignerInteractionHistory getInstance() {
if (history == null) {
history = new DesignerInteractionHistory();
readXMLFile(history, history.getHistoryFile());
}
return history;
}
private File getHistoryFile() {
return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME));
}
private static void readXMLFile(XMLReadable xmlReadable, File xmlFile) {
if (xmlFile == null || !xmlFile.exists()) {
return;
}
String charset = EncodeConstants.ENCODING_UTF_8;
try {
String decodeContent = getFileContent(xmlFile);
InputStream xmlInputStream = new ByteArrayInputStream(decodeContent.getBytes(charset));
InputStreamReader inputStreamReader = new InputStreamReader(xmlInputStream, charset);
XMLableReader xmlReader = XMLableReader.createXMLableReader(inputStreamReader);
if (xmlReader != null) {
xmlReader.readXMLObject(xmlReadable);
}
xmlInputStream.close();
} catch (IOException | XMLStreamException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private static String getFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException {
InputStream encodeInputStream = new FileInputStream(xmlFile);
return IOUtils.inputStream2String(encodeInputStream);
}
private static void writeContentToFile(String fileContent, File file) {
try (FileOutputStream fos = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
BufferedWriter bw = new BufferedWriter(osw)) {
bw.write(fileContent);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public void saveXMLFile() {
File xmlFile = this.getHistoryFile();
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLTools.writeOutputStreamXML(this, out);
out.flush();
out.close();
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
writeContentToFile(fileContent, xmlFile);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private static final String HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP = "hasShownShiftDragResizingTooltip";
private static final String LAST_SELECTED_BORDER_IMAGE_DIR = "lastSelectedBorderImageDir";
// 是否已展示过按下Shift键可锁定比例拖拽尺寸的Tooltip
private boolean hasShownShiftDragResizingTooltip = false;
// 用户上次通过文件选择器选择的边框图片所在目录
private String lastSelectedBorderImageDir = StringUtils.EMPTY;
public boolean isHasShownShiftDragResizingTooltip() {
return hasShownShiftDragResizingTooltip;
}
public void setHasShownShiftDragResizingTooltip(boolean shown) {
this.hasShownShiftDragResizingTooltip = shown;
}
public String getLastSelectedBorderImageDir() {
return lastSelectedBorderImageDir;
}
public void setLastSelectedBorderImageDir(String dirPath) {
this.lastSelectedBorderImageDir = dirPath;
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(ROOT_TAG)
.attr(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, isHasShownShiftDragResizingTooltip())
.attr(LAST_SELECTED_BORDER_IMAGE_DIR, getLastSelectedBorderImageDir())
.end();
}
@Override
public void readXML(XMLableReader reader) {
setHasShownShiftDragResizingTooltip(reader.getAttrAsBoolean(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, false));
setLastSelectedBorderImageDir(reader.getAttrAsString(LAST_SELECTED_BORDER_IMAGE_DIR, StringUtils.EMPTY));
}
}

16
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -111,15 +111,10 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
northPane.setLayout(new BorderLayout()); northPane.setLayout(new BorderLayout());
northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
JPanel addPanel = new JPanel();
addPanel.setLayout(new BorderLayout());
addPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
addPanel.add(addButton, BorderLayout.CENTER);
JPanel button = new JPanel(); JPanel button = new JPanel();
button.setPreferredSize(new Dimension(95, 20)); button.setPreferredSize(new Dimension(89, 20));
button.setLayout(new GridLayout(1, 4, 0, 0)); button.setLayout(new GridLayout(1, 4, 3, 0));
button.add(addPanel); button.add(addButton);
button.add(copyButton); button.add(copyButton);
button.add(moveForwardButton); button.add(moveForwardButton);
button.add(moveBackButton); button.add(moveBackButton);
@ -135,14 +130,11 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
copyButton.setBorderPainted(false);
copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy"));
moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png")); moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png"));
moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left")); moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left"));
moveForwardButton.setBorderPainted(false);
moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png")); moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png"));
moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right")); moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right"));
moveBackButton.setBorderPainted(false);
initAddButton(); initAddButton();
initConfigButton(); initConfigButton();
initMoveButton(); initMoveButton();
@ -312,7 +304,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
} }
private String getCopyChartName() { private String getCopyChartName() {
String chartName = "CopyOf" + editingCollection.getChartName(editingCollection.getSelectedIndex()); String chartName = editingCollection.getChartName(editingCollection.getSelectedIndex()) + "_Copy";
if (!nameRepeated(chartName)) { if (!nameRepeated(chartName)) {
return chartName; return chartName;
} }

25
designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java

@ -3,17 +3,19 @@
*/ */
package com.fr.design.designer.beans.location; package com.fr.design.designer.beans.location;
import com.fr.config.ServerPreferenceConfig;
import com.fr.config.utils.ConfigReadUtils;
import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.Absorptionline;
import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelection;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.env.utils.DesignerInteractionHistory;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WParameterLayout;
import java.awt.*; import java.awt.*;
@ -196,12 +198,21 @@ public abstract class AccessDirection implements Direction {
// 设置当前形状 // 设置当前形状
formEditor.setCursor(Cursor.getPredefinedCursor(type)); formEditor.setCursor(Cursor.getPredefinedCursor(type));
// 显示/改变Tooltip
showTooltip(formEditor);
}
}
private void showTooltip(FormDesigner formEditor) {
// 显示拖拽改变组件尺寸相关的提示信息
int cursorType = formEditor.getCursor().getType();
if (Cursor.SW_RESIZE_CURSOR <= cursorType && cursorType <= Cursor.E_RESIZE_CURSOR) {
FormSelection selection = formEditor.getSelectionModel().getSelection(); FormSelection selection = formEditor.getSelectionModel().getSelection();
boolean canLockAspectRatioOnlyByShift = !selection.isCreatorAspectRatioLockedInAbsLayout(formEditor) && selection.isCreatorInAbsLayout(formEditor); boolean canLockAspectRatioOnlyByShift = !selection.isCreatorAspectRatioLockedInAbsLayout(formEditor) && selection.isCreatorInAbsLayout(formEditor);
ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); DesignerInteractionHistory history = DesignerInteractionHistory.getInstance();
if (canLockAspectRatioOnlyByShift && !config.isHasShownLockedAspectRatioResizingToolTip()) { if (canLockAspectRatioOnlyByShift && !history.isHasShownShiftDragResizingTooltip()) {
formEditor.setToolTipText(getTooltip()); formEditor.setToolTipText(getTooltip());
config.setHasShownLockedAspectRatioResizingToolTip(true); history.setHasShownShiftDragResizingTooltip(true);
} }
} }
} }

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

@ -1,6 +1,7 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Releasable;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -32,7 +33,7 @@ import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.util.Set; import java.util.Set;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider { public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider , Releasable {
private UILabel imageLable; private UILabel imageLable;
private FormDesigner designer; private FormDesigner designer;
private static BufferedImage DEFAULT_BACKGROUND; private static BufferedImage DEFAULT_BACKGROUND;
@ -352,4 +353,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
public boolean isSupportShared() { public boolean isSupportShared() {
return true; return true;
} }
@Override
public void releaseResources() {
imageLable.setIcon(null);
}
} }

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

@ -203,6 +203,10 @@ public class XWAbsoluteLayout extends XLayoutContainer {
double percentH = ((double) backupBound.height / (double) currentBound.height); double percentH = ((double) backupBound.height / (double) currentBound.height);
for (int index = 0, n = this.getComponentCount(); index < n; index++) { for (int index = 0, n = this.getComponentCount(); index < n; index++) {
XCreator creator = (XCreator) this.getComponent(index); XCreator creator = (XCreator) this.getComponent(index);
if (creator.toData().isAspectRatioLocked()) {
double percent = Math.min(percentW, percentH);
percentW = percentH = percent;
}
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
// 用当前的显示大小计算后调正具体位置 // 用当前的显示大小计算后调正具体位置
Rectangle wgtBound = creator.getBounds(); Rectangle wgtBound = creator.getBounds();

9
designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java

@ -2,7 +2,6 @@ package com.fr.design.gui.controlpane;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.file.Releasable;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.EventCreator; import com.fr.design.widget.EventCreator;
@ -14,7 +13,7 @@ import com.fr.stable.Nameable;
/** /**
* Created by kerry on 5/17/21 * Created by kerry on 5/17/21
*/ */
public class EventPropertyPane extends UIListGroupControlPane implements Releasable { public class EventPropertyPane extends UIListGroupControlPane {
private XCreator creator; private XCreator creator;
private FormDesigner designer; private FormDesigner designer;
@ -25,12 +24,6 @@ public class EventPropertyPane extends UIListGroupControlPane implements Releasa
this.designer = designer; this.designer = designer;
} }
@Override
public void releaseResources() {
creator = null;
designer = null;
this.removeAll();
}
/** /**
* 刷新 * 刷新

18
designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

@ -5,7 +5,6 @@ import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
@ -27,6 +26,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.backgroundpane.ImagePreviewPane; import com.fr.design.mainframe.backgroundpane.ImagePreviewPane;
import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.env.utils.DesignerInteractionHistory;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -62,7 +62,7 @@ import java.net.URISyntaxException;
* 可配置图片类型边框的样式设置面板 * 可配置图片类型边框的样式设置面板
*/ */
public class BorderLineAndImagePane extends JPanel implements UIObserver { public class BorderLineAndImagePane extends JPanel implements UIObserver {
private final int SETTING_LABEL_WIDTH = 60; private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH;
private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT);
private final String TWEAK_NINE_POINT_HELP_URL = ""; private final String TWEAK_NINE_POINT_HELP_URL = "";
@ -179,14 +179,14 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
} }
private void initImageFileChooserDirectory() { private void initImageFileChooserDirectory() {
ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); DesignerInteractionHistory history = DesignerInteractionHistory.getInstance();
String lastUsedBorderImagesDirPath = config.getLastUsedBorderImagesDir(); String lastUsedBorderImageDirPath = history.getLastSelectedBorderImageDir();
File lastUsedBorderImagesDir = StringUtils.isNotEmpty(lastUsedBorderImagesDirPath) ? new File(lastUsedBorderImagesDirPath) : null; File lastUsedBorderImageDir = StringUtils.isNotEmpty(lastUsedBorderImageDirPath) ? new File(lastUsedBorderImageDirPath) : null;
File inbuiltBorderImagesDir = new File(StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSETS_NAME, "border_images")); File inbuiltBorderImagesDir = new File(StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSETS_NAME, "border_images"));
if (lastUsedBorderImagesDir!= null && lastUsedBorderImagesDir.exists()) { if (lastUsedBorderImageDir!= null && lastUsedBorderImageDir.exists()) {
imageFileChooser.setCurrentDirectory(lastUsedBorderImagesDir); imageFileChooser.setCurrentDirectory(lastUsedBorderImageDir);
} else if (inbuiltBorderImagesDir.exists()) { } else if (inbuiltBorderImagesDir.exists()) {
imageFileChooser.setCurrentDirectory(inbuiltBorderImagesDir); imageFileChooser.setCurrentDirectory(inbuiltBorderImagesDir);
} }
@ -232,9 +232,9 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame());
if (returnVal == JFileChooser.APPROVE_OPTION) { if (returnVal == JFileChooser.APPROVE_OPTION) {
ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); DesignerInteractionHistory history = DesignerInteractionHistory.getInstance();
File selectedDirectory = imageFileChooser.getSelectedFile().getParentFile(); File selectedDirectory = imageFileChooser.getSelectedFile().getParentFile();
config.setLastUsedBorderImagesDir(selectedDirectory.getPath()); history.setLastSelectedBorderImageDir(selectedDirectory.getPath());
} }
ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() {

14
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

@ -24,6 +24,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetTitle;
import com.fr.general.Background; import com.fr.general.Background;
@ -51,7 +52,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow")
}; };
private static final Dimension BUTTON_SIZE = new Dimension(20, 20); private static final Dimension BUTTON_SIZE = new Dimension(20, 20);
private static final int SETTING_LABEL_WIDTH = 60; public static final int SETTING_LABEL_WIDTH = 60;
protected LayoutBorderStyle style = new LayoutBorderStyle(); protected LayoutBorderStyle style = new LayoutBorderStyle();
@ -124,7 +125,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
borderStyleCombo = new UIComboBox(BORDER_STYLE); borderStyleCombo = new UIComboBox(BORDER_STYLE);
borderLineAndImagePane = new BorderLineAndImagePane(); borderLineAndImagePane = new BorderLineAndImagePane();
cornerSpinner = new UISpinner(0,1000,1,0); cornerSpinner = new UISpinner(0,1000,1,0);
backgroundPane = new BackgroundSpecialPane(); backgroundPane = new LayoutBackgroundSpecialPane();
backgroundOpacityPane = new UIPercentDragPane(); backgroundOpacityPane = new UIPercentDragPane();
} }
@ -229,7 +230,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")
}); });
titleBackgroundPane = new BackgroundSpecialPane(); titleBackgroundPane = new LayoutBackgroundSpecialPane();
titleBackgroundOpacityPane = new UIPercentDragPane(); titleBackgroundOpacityPane = new UIPercentDragPane();
} }
@ -499,4 +500,11 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
g2d.setColor(oldColor); g2d.setColor(oldColor);
} }
} }
protected static class LayoutBackgroundSpecialPane extends BackgroundSpecialPane {
@Override
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() {
return new GradientBackgroundQuickPane(140);
}
}
} }

71
designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java

@ -33,6 +33,10 @@ import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D;
/** /**
* @author Starryi * @author Starryi
@ -40,7 +44,7 @@ import java.awt.event.ActionListener;
* Created by Starryi on 2021/7/3 * Created by Starryi on 2021/7/3
*/ */
public class TitleInsetImagePane extends JPanel implements UIObserver { public class TitleInsetImagePane extends JPanel implements UIObserver {
private final int SETTING_LABEL_WIDTH = 60; private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH;
private final int DELETE_BUTTON_SIZE = 24; private final int DELETE_BUTTON_SIZE = 24;
private final int IMAGE_PREVIEW_SIZE = 145; private final int IMAGE_PREVIEW_SIZE = 145;
private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT);
@ -89,6 +93,28 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
deletableImagePreviewPane.add(imageDeleteButton, 0); deletableImagePreviewPane.add(imageDeleteButton, 0);
deletableImagePreviewPane.add(imagePreviewPane, 1); deletableImagePreviewPane.add(imagePreviewPane, 1);
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
deletableImagePreviewPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
super.mouseEntered(e);
imageDeleteButton.setVisible(true);
imageDeleteButton.setEnabled(true);
}
@Override
public void mouseExited(MouseEvent e) {
super.mouseExited(e);
int x = e.getX();
int y = e.getY();
if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) {
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
}
}
});
return TableLayoutHelper.createCommonTableLayoutPane( return TableLayoutHelper.createCommonTableLayoutPane(
new JComponent[][]{ new JComponent[][]{
{null, deletableImagePreviewPane}, {null, deletableImagePreviewPane},
@ -110,15 +136,11 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
private void initComponents() { private void initComponents() {
imageChooseButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_choose_inset.png")); imageChooseButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_choose_inset.png"));
imageDeleteButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png")); imageDeleteButton = new OpaqueColorButton(
imageDeleteButton.setUI(new BasicButtonUI()); IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"),
imageDeleteButton.setOpaque(true); new Color(51, 51, 52, 178),
imageDeleteButton.setBorderPainted(false); 2);
imageDeleteButton.setBorder(null);
imageDeleteButton.setFocusPainted(false);
imageDeleteButton.setContentAreaFilled(true);
imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE));
imageDeleteButton.setBackground(new Color(51, 51, 51));
imagePreviewPane = new ImagePreviewPane(); imagePreviewPane = new ImagePreviewPane();
imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE); imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE);
@ -255,4 +277,35 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
private static class OpaqueColorButton extends UIButton {
private final Color color;
private final int radius;
public OpaqueColorButton(Icon icon, Color color, int radius) {
super(icon);
setUI(new BasicButtonUI());
setOpaque(true);
setBorderPainted(false);
setBorder(null);
setFocusPainted(false);
setContentAreaFilled(false);
this.color = color;
this.radius = radius;
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor();
Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), radius, radius);
g2d.clip(shape);
g2d.setColor(color);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setColor(oldColor);
super.paint(g);
}
}
} }

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

@ -7,7 +7,6 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.file.Releasable;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.FormWidgetOption;
import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption;
@ -57,7 +56,7 @@ import java.awt.event.MouseEvent;
/** /**
* @author null * @author null
*/ */
public class FormParaWidgetPane extends JPanel implements Releasable { public class FormParaWidgetPane extends JPanel {
private static FormParaWidgetPane THIS; private static FormParaWidgetPane THIS;
private final static int BORDER = 5; private final static int BORDER = 5;
private final static int WIDGET_WIDTHGAP = 4; private final static int WIDGET_WIDTHGAP = 4;
@ -120,15 +119,6 @@ public class FormParaWidgetPane extends JPanel implements Releasable {
return THIS; return THIS;
} }
public static FormParaWidgetPane getInstance(){
return THIS;
}
@Override
public void releaseResources() {
designer = null;
}
public FormParaWidgetPane() { public FormParaWidgetPane() {
setLayout(new FlowLayout(FlowLayout.LEFT)); setLayout(new FlowLayout(FlowLayout.LEFT));
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() { DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() {

8
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -2,7 +2,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.file.Releasable;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -31,7 +30,7 @@ import java.util.List;
* Date: 14-7-8 * Date: 14-7-8
* Time: 下午8:18 * Time: 下午8:18
*/ */
public class FormWidgetDetailPane extends FormDockView implements Releasable { public class FormWidgetDetailPane extends FormDockView{
private static final int ONLINE_TAB = 1; private static final int ONLINE_TAB = 1;
private JPanel centerPane; private JPanel centerPane;
@ -62,11 +61,6 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable {
private static FormWidgetDetailPane singleton = new FormWidgetDetailPane(); private static FormWidgetDetailPane singleton = new FormWidgetDetailPane();
} }
@Override
public void releaseResources() {
setEditingFormDesigner(null);
}
public String getViewTitle() { public String getViewTitle() {
return Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table"); return Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table");
} }

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

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.PaperSize; import com.fr.base.PaperSize;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.Releasable;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
@ -26,6 +27,7 @@ import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XComponent; import com.fr.design.designer.creator.XComponent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
@ -72,6 +74,7 @@ import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.share.utils.ShareUtils; import com.fr.form.share.utils.ShareUtils;
import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
@ -110,14 +113,13 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form> { public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form>, Releasable {
private static final String FORM_CARD = "FORM"; private static final String FORM_CARD = "FORM";
private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; private static final String ELEMENTCASE_CARD = "ELEMENTCASE";
private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD}; private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD};
private static final int TOOLBARPANEDIMHEIGHT_FORM = 60; private static final int TOOLBARPANEDIMHEIGHT_FORM = 60;
//当前使用的表单设计器
private static FormDesigner currentFormDesign;
//表单设计器 //表单设计器
private FormDesigner formDesign; private FormDesigner formDesign;
//格子设计器 //格子设计器
@ -859,7 +861,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane); EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
refreshWidgetLibPane(); refreshWidgetLibPane();
currentFormDesign = formDesign;
} }
private void refreshWidgetLibPane() { private void refreshWidgetLibPane() {
@ -1096,18 +1097,41 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
} }
public static void traversalXCreator(XCreator xCreator, XCreateGather xCreateGather, Class clz) {
xCreator.getComponentCount();
for (int i = 0; i < xCreator.getComponentCount(); i++) {
Component component = xCreator.getComponent(i);
if (component instanceof XCreator) {
if (clz == null || clz.isInstance(component)) {
xCreateGather.dealWith((XCreator) component);
}
traversalXCreator((XCreator) component, xCreateGather, clz);
}
}
}
@Override @Override
public void whenClose() { public void whenClose() {
super.whenClose(); super.whenClose();
releaseResources(); this.releaseResources();
} }
private void releaseResources() { @Override
if (ComparatorUtils.equals(currentFormDesign, formDesign)) { public void releaseResources() {
FormParaWidgetPane.getInstance().releaseResources(); if (formDesign != null) {
FormWidgetDetailPane.getInstance().releaseResources(); Form.traversalWidget(formDesign.getTarget().getContainer(), new WidgetGatherAdapter() {
WidgetPropertyPane.getInstance().releaseResources(); @Override
currentFormDesign = null; public void dealWith(Widget widget) {
((ElementCaseEditor) widget).releaseResources();
}
}, ElementCaseEditor.class);
JForm.traversalXCreator(formDesign.getRootComponent(), new XCreateGather() {
@Override
public void dealWith(XCreator xCreator) {
((XElementCase) xCreator).releaseResources();
}
}, XElementCase.class);
} }
} }
} }

28
designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java

@ -9,7 +9,6 @@ import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI; import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.designer.properties.mobile.MobileStylePropertyUI; import com.fr.design.designer.properties.mobile.MobileStylePropertyUI;
import com.fr.design.file.Releasable;
import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.controlpane.EventPropertyPane; import com.fr.design.gui.controlpane.EventPropertyPane;
@ -33,7 +32,7 @@ import java.util.Set;
* 控件属性表绘制 * 控件属性表绘制
* Modified by fanglei * Modified by fanglei
*/ */
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane, Releasable { public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane {
private static final int PADDING = 10; private static final int PADDING = 10;
private static final int PADDING_M = 12; private static final int PADDING_M = 12;
@ -69,31 +68,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
} }
@Override
public void releaseResources() {
setEditingFormDesigner(null);
if (eventTable != null) {
eventTable.releaseResources();
}
if (formWidgetCardPane != null) {
formWidgetCardPane.releaseResources();
}
if (wsp != null) {
wsp.removeAll();
}
designer.getSelectionModel().reset();
formWidgetCardPane = null;
eventTable = null;
widgetPropertyTables = null;
mobileExtraPropertyPanes = null;
designer = null;
psp = null;
wsp = null;
tabsHeaderIconPane = null;
lastAffectedCreator = null;
this.removeAll();
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Control_Setting"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Control_Setting");

7
designer-form/src/main/java/com/fr/design/mainframe/XCreateGather.java

@ -0,0 +1,7 @@
package com.fr.design.mainframe;
import com.fr.design.designer.creator.XCreator;
public interface XCreateGather {
void dealWith(XCreator xCreator);
}

15
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -14,7 +14,6 @@ import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.file.Releasable;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
@ -50,7 +49,7 @@ import java.awt.BorderLayout;
/** /**
* Created by ibm on 2017/7/25. * Created by ibm on 2017/7/25.
*/ */
public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements Releasable { public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
private AttributeChangeListener listener; private AttributeChangeListener listener;
private FormDesigner designer; private FormDesigner designer;
//当前的编辑器属性定义面板 //当前的编辑器属性定义面板
@ -283,16 +282,4 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements Rele
public void firePropertyEdit() { public void firePropertyEdit() {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
} }
@Override
public void releaseResources() {
listener = null;
designer = null;
currentEditorDefinePane = null;
widgetPropertyPane = null;
attriCardPane = null;
xCreator = null;
widgetBoundPane = null;
this.removeAll();
}
} }

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -104,6 +104,10 @@ public class WidgetBoundPane extends BasicPane {
public void populate() { public void populate() {
Rectangle bounds = new Rectangle(creator.getBounds()); Rectangle bounds = new Rectangle(creator.getBounds());
if (ratioLockedButton != null) {
// 临时禁止尺寸比例锁定,关掉widthSpinner/heightSpinner之间的数值关联,以更新其高度和宽度值
ratioLockedButton.setLocked(false);
}
width.setValue(bounds.width); width.setValue(bounds.width);
height.setValue(bounds.height); height.setValue(bounds.height);
if (ratioLockedButton != null) { if (ratioLockedButton != null) {

4
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -42,6 +42,7 @@ import com.fr.design.monitor.DesignerLifecycleMonitorContext;
import com.fr.design.share.SharableManager; import com.fr.design.share.SharableManager;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.env.utils.DesignerInteractionHistory;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
@ -512,6 +513,9 @@ public class MainDesigner extends BaseDesigner {
InformationCollector collector = InformationCollector.getInstance(); InformationCollector collector = InformationCollector.getInstance();
collector.collectStopTime(); collector.collectStopTime();
collector.saveXMLFile(); collector.saveXMLFile();
DesignerInteractionHistory historyCollector = DesignerInteractionHistory.getInstance();
historyCollector.saveXMLFile();
} }
} }

Loading…
Cancel
Save