diff --git a/designer-base/src/main/java/com/fr/design/file/Releasable.java b/designer-base/src/main/java/com/fr/design/file/Releasable.java deleted file mode 100644 index cb78789e6..000000000 --- a/designer-base/src/main/java/com/fr/design/file/Releasable.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.fr.design.file; - -public interface Releasable { - void releaseResources(); -} diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index 454b1e5b9..9d10da3a7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/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内的数字文本框长度 */ private int numberFieldColumns; + private boolean hasTextFieldFocus = false; public UISpinner() { @@ -318,7 +319,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver @Override 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()); } } @@ -330,8 +331,14 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver textField.getDocument().removeDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener); textField.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + hasTextFieldFocus = true; + } + @Override public void focusLost(FocusEvent e) { + hasTextFieldFocus = false; textField.getDocument().removeDocumentListener(docListener); textField.setValue(value); textField.getDocument().addDocumentListener(docListener); diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java index 7fa266423..ee05a8b59 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java @@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{ fireStateChanged(); } }); - GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); + GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane(); gradientPane.registerChangeListener(new UIObserverListener() { @Override public void doChange() { @@ -68,4 +68,9 @@ public class BackgroundSpecialPane extends BackgroundPane{ return kinds.toArray(new BackgroundQuickPane[kinds.size()]); } + + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + // 使用默认的150宽度构建渐变条 + return new GradientBackgroundQuickPane(); + } } diff --git a/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java b/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java new file mode 100644 index 000000000..45cebca48 --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java @@ -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)); + } +} diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png b/designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png new file mode 100644 index 000000000..6168d9a98 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_unlock.png b/designer-base/src/main/resources/com/fr/design/images/control/edit_unlock.png new file mode 100644 index 000000000..fae22d26d Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/control/edit_unlock.png differ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 587cdad99..1fdd6e9fd 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -111,15 +111,10 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen northPane.setLayout(new BorderLayout()); 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(); - button.setPreferredSize(new Dimension(95, 20)); - button.setLayout(new GridLayout(1, 4, 0, 0)); - button.add(addPanel); + button.setPreferredSize(new Dimension(89, 20)); + button.setLayout(new GridLayout(1, 4, 3, 0)); + button.add(addButton); button.add(copyButton); button.add(moveForwardButton); button.add(moveBackButton); @@ -135,14 +130,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.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.setBorderPainted(false); copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png")); 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.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right")); - moveBackButton.setBorderPainted(false); initAddButton(); initConfigButton(); initMoveButton(); @@ -312,7 +304,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private String getCopyChartName() { - String chartName = "CopyOf" + editingCollection.getChartName(editingCollection.getSelectedIndex()); + String chartName = editingCollection.getChartName(editingCollection.getSelectedIndex()) + "_Copy"; if (!nameRepeated(chartName)) { return chartName; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java index f960b4aff..1a0b78982 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java @@ -293,7 +293,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString)); - timeAxis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString)); + timeAxis.setMinValue(createDataFormula(dateString)); } } else { timeAxis.setCustomMinValue(false); @@ -308,7 +308,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString)); - timeAxis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString)); + timeAxis.setMaxValue(createDataFormula(dateString)); } } else { timeAxis.setCustomMaxValue(false); @@ -332,6 +332,11 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { checkBoxUse(); } + private BaseFormula createDataFormula(String dateString) { + String formulaString = "\"" + dateString + "\""; + return BaseFormula.createFormulaBuilder().build(formulaString); + } + public void populate(VanChartTimeAxis timeAxis){ // 最小值 if (timeAxis.isCustomMinValue() && timeAxis.getMinValue() != null) { diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java index adb0c6017..eae04d998 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java @@ -3,17 +3,19 @@ */ 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.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.FormSelection; 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.BoundsWidget; -import com.fr.form.ui.container.WParameterLayout; import java.awt.*; @@ -196,15 +198,24 @@ public abstract class AccessDirection implements Direction { // 设置当前形状 formEditor.setCursor(Cursor.getPredefinedCursor(type)); - FormSelection selection = formEditor.getSelectionModel().getSelection(); + // 显示/改变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(); boolean canLockAspectRatioOnlyByShift = !selection.isCreatorAspectRatioLockedInAbsLayout(formEditor) && selection.isCreatorInAbsLayout(formEditor); - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); - if (canLockAspectRatioOnlyByShift && !config.isHasShownLockedAspectRatioResizingToolTip()) { + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); + if (canLockAspectRatioOnlyByShift && !history.isHasShownShiftDragResizingTooltip()) { formEditor.setToolTipText(getTooltip()); - config.setHasShownLockedAspectRatioResizingToolTip(true); + history.setHasShownShiftDragResizingTooltip(true); } - } - } + } + } public String getTooltip() { return null; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java b/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java deleted file mode 100644 index fe2d839b9..000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fr.design.designer.creator; - -import com.fr.design.form.util.XCreatorConstants; -import com.fr.general.IOUtils; -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Rectangle; - -/** - * @author hades - * @version 10.0 - * Created by hades on 2021/06/30 - */ -public class SelectedBorderIcon { - - private static final Image EDIT_ICON = IOUtils.readImage("/com/fr/design/images/control/show_edit.png"); - private static final Image SETTING_ICON = IOUtils.readImage("/com/fr/design/images/control/show_setting.png"); - private static final float ALPHA = 0.7F; - private static final int TIP_WIDTH = 20; - private static final int TIP_HEIGHT = 40; - private static final int ARC_VALUE = 4; - // 组件到整个提示之间的空隙 - private static final int CREATOR_TO_TIP_GAP = 5; - // icon在整个提示背景下缩进 - private static final int TIP_ICON_GAP = 2; - - /** - * 在bounds范围的右上角绘制特定图标 - * - * @param g - * @param bounds - */ - public void paint(Graphics g, Rectangle bounds) { - Graphics2D g2d = (Graphics2D) g; - AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, ALPHA); - g2d.setColor(XCreatorConstants.EDIT_COLOR); - g2d.setComposite(alphaComposite); - g2d.fillRoundRect(bounds.x + bounds.width + CREATOR_TO_TIP_GAP, bounds.y, TIP_WIDTH, TIP_HEIGHT, ARC_VALUE, ARC_VALUE); - g2d.drawImage(EDIT_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_ICON_GAP, EDIT_ICON.getWidth(null), EDIT_ICON.getHeight(null), null); - g2d.drawImage(SETTING_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + CREATOR_TO_TIP_GAP + EDIT_ICON.getHeight(null), SETTING_ICON.getWidth(null), SETTING_ICON.getHeight(null), null); - g2d.setColor(Color.WHITE); - g2d.drawLine(bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_WIDTH, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP + EDIT_ICON.getWidth(null), bounds.y + TIP_WIDTH); - } -} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 7220eafe8..80bf1b51d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.ui.SelectedPopupDialog; import com.fr.design.fun.ShareWidgetUIProcessor; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.imenu.UIPopupMenu; @@ -70,7 +71,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上 // 当前组件是否处在选中状态 private boolean selected; - private SelectedBorderIcon selectedBorderIcon = new SelectedBorderIcon(); + private SelectedPopupDialog popup; private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 public XCreator(Widget ob, Dimension initSize) { @@ -764,15 +765,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } /** - * 绘制选中时右上边框图标 + * 选中时右侧展示小弹窗 * - * @param g + * @param designer * @param bounds */ - public void paintSelectedBorderIcon(Graphics g, Rectangle bounds) { - if (selected) { - selectedBorderIcon.paint(g, bounds); + public void showSelectedPopup(FormDesigner designer, Rectangle bounds, boolean accept) { + if (popup == null) { + popup = new SelectedPopupDialog(this, designer); } + int extraX = (int) ((bounds.x + bounds.width + SelectedPopupDialog.OFFSET_X) * designer.getScale()); + int extraY = (int) (bounds.y * designer.getScale()); + popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); + popup.setVisible(selected && accept); + popup.setRelativeBounds(bounds); } /** @@ -818,6 +824,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void setSelected(boolean selected) { this.selected = selected; + if (popup != null && !selected) { + popup.setVisible(false); + } } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 4729be0b5..7ed22c52d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -1,6 +1,7 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; +import com.fr.base.Releasable; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; @@ -32,7 +33,7 @@ import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.util.Set; -public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider { +public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider , Releasable { private UILabel imageLable; private FormDesigner designer; private static BufferedImage DEFAULT_BACKGROUND; @@ -352,4 +353,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public boolean isSupportShared() { return true; } + + @Override + public void releaseResources() { + imageLable.setIcon(null); + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 60197ba12..72bb2cb03 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/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); for (int index = 0, n = this.getComponentCount(); index < n; 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()); // 用当前的显示大小计算后调正具体位置 Rectangle wgtBound = creator.getBounds(); diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java new file mode 100644 index 000000000..b8133d3da --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -0,0 +1,191 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.CoverReportPane; +import com.fr.design.mainframe.EditingMouseListener; +import com.fr.design.mainframe.FormDesigner; +import com.fr.general.IOUtils; +import com.fr.stable.ArrayUtils; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import javax.swing.AbstractButton; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/7/8 + */ +public class PopupControlPanel extends JPanel { + + private static final int ARC_VALUE = 4; + private static final Color FILLED_COLOR = new Color(60, 63, 65); + private static final int V_GAP = 10; + private static final int H_GAP = 2; + + private Dimension defaultDimension = new Dimension(20, 60); + private Rectangle rectangle; + private final JButton editButton; + private final JButton settingButton; + private final JToggleButton toggleButton; + private final XCreator creator; + private final UILabel firstLabel; + private final UILabel secondLabel; + + public PopupControlPanel(XCreator creator, FormDesigner designer) { + if (creator.isShared()) { + defaultDimension = new Dimension(20, 85); + } + setLayout(getCustomLayout()); + this.creator = creator; + editButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_edit.png"), Toolkit.i18nText("Fine-Design_Form_Edit_Widget")); + editButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + int x = rectangle.x + rectangle.width / 2; + int y = rectangle.y + rectangle.height / 2; + XCreator childCreator = PopupControlPanel.this.creator.getEditingChildCreator(); + MouseListener[] listeners = designer.getMouseListeners(); + if (ArrayUtils.isNotEmpty(listeners) && listeners[0] instanceof EditingMouseListener) { + childCreator.respondClick(((EditingMouseListener) listeners[0]), new MouseEvent(childCreator, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), x, y, 2, false)); + } + } + }); + settingButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_setting.png"), Toolkit.i18nText("Fine-Design_Share_Help_Settings")); + + settingButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + CoverReportPane.showShareConfig(creator.toData()); + } + }); + toggleButton = new JToggleButton(IOUtils.readIcon("/com/fr/design/images/control/edit_lock.png")); + initButtonStyle(toggleButton); + toggleButton.setSelectedIcon(IOUtils.readIcon("com/fr/design/images/control/edit_unlock.png")); + toggleButton.setToolTipText(Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio")); + toggleButton.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + JToggleButton toggleBtn = (JToggleButton) e.getSource(); + String toolTipText = toggleBtn.isSelected() ? Toolkit.i18nText("Fine-Design_Form_UnLock_Widget_Ratio") : Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio"); + toggleBtn.setToolTipText(toolTipText); + } + }); + + firstLabel = createLabel(); + secondLabel = createLabel(); + + add(editButton); + add(toggleButton); + add(settingButton); + add(firstLabel); + add(secondLabel); + } + + protected LayoutManager getCustomLayout() { + return new LayoutManager() { + + @Override + public void removeLayoutComponent(Component comp) { + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + return defaultDimension; + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + int width = parent.getPreferredSize().width; + int buttonWidth = editButton.getPreferredSize().width; + int buttonHeight = editButton.getPreferredSize().height; + int x = (width - buttonWidth) / 2; + editButton.setBounds(x, V_GAP, buttonWidth, buttonHeight); + firstLabel.setBounds(x, V_GAP + editButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); + toggleButton.setBounds(x, V_GAP * 2 + editButton.getHeight(), buttonWidth, buttonHeight); + if (creator.isShared()) { + secondLabel.setBounds(x, V_GAP * 2 + editButton.getHeight() + toggleButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); + settingButton.setBounds(x, V_GAP * 3 + editButton.getHeight() + toggleButton.getHeight(), buttonWidth, buttonHeight); + } + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + } + + private JButton createNormalButton(Icon icon, String toolTipText) { + JButton button = new JButton(icon); + initButtonStyle(button); + button.setToolTipText(toolTipText); + return button; + } + + private void initButtonStyle(AbstractButton button) { + button.setBorderPainted(false); + button.setBorder(null); + button.setMargin(new Insets(0, 0, 0, 0)); + button.setContentAreaFilled(false); + } + + private UILabel createLabel() { + return new UILabel() { + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(Color.WHITE); + g2d.drawLine(H_GAP, 0, toggleButton.getWidth() - H_GAP, 0); + + } + }; + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + int w = this.getWidth(); + int h = this.getHeight(); + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setColor(FILLED_COLOR); + g2d.fillRoundRect(0, 0, w - 1, h - 1, ARC_VALUE, ARC_VALUE); + g2d.setColor(Color.WHITE); + g2d.drawRoundRect(0, 0, w - 1, h - 1, ARC_VALUE, ARC_VALUE); + } + + public Dimension getDefaultDimension() { + return defaultDimension; + } + + public void setRelativeBounds(Rectangle rectangle) { + this.rectangle = rectangle; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java new file mode 100644 index 000000000..e7de92679 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -0,0 +1,36 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import java.awt.Rectangle; +import javax.swing.JDialog; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/7/09 + */ +public class SelectedPopupDialog extends JDialog { + + /** + * 弹窗的相对组件的偏移 + */ + public static final int OFFSET_X = 5; + + private final PopupControlPanel controlPanel; + + public SelectedPopupDialog(XCreator creator, FormDesigner designer) { + super(DesignerContext.getDesignerFrame()); + this.setUndecorated(true); + this.setModal(false); + controlPanel = new PopupControlPanel(creator, designer); + this.getContentPane().add(controlPanel); + this.setSize(controlPanel.getDefaultDimension()); + } + + public void setRelativeBounds(Rectangle rectangle) { + this.controlPanel.setRelativeBounds(rectangle); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java index 834b6b4a8..2a67f61ae 100644 --- a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java +++ b/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.properties.EventPropertyTable; -import com.fr.design.file.Releasable; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesigner; import com.fr.design.widget.EventCreator; @@ -14,7 +13,7 @@ import com.fr.stable.Nameable; /** * Created by kerry on 5/17/21 */ -public class EventPropertyPane extends UIListGroupControlPane implements Releasable { +public class EventPropertyPane extends UIListGroupControlPane { private XCreator creator; private FormDesigner designer; @@ -25,12 +24,6 @@ public class EventPropertyPane extends UIListGroupControlPane implements Releasa this.designer = designer; } - @Override - public void releaseResources() { - creator = null; - designer = null; - this.removeAll(); - } /** * 刷新 diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index ca8b5abeb..27c045459 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/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.background.ImageBackground; import com.fr.base.background.ImageFileBackground; -import com.fr.config.ServerPreferenceConfig; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; 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.backgroundpane.ImagePreviewPane; import com.fr.design.style.background.image.ImageFileChooser; +import com.fr.env.utils.DesignerInteractionHistory; import com.fr.form.ui.LayoutBorderStyle; import com.fr.general.Background; import com.fr.general.IOUtils; @@ -62,7 +62,7 @@ import java.net.URISyntaxException; * 可配置图片类型边框的样式设置面板 */ 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 String TWEAK_NINE_POINT_HELP_URL = ""; @@ -179,14 +179,14 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } private void initImageFileChooserDirectory() { - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); - String lastUsedBorderImagesDirPath = config.getLastUsedBorderImagesDir(); - File lastUsedBorderImagesDir = StringUtils.isNotEmpty(lastUsedBorderImagesDirPath) ? new File(lastUsedBorderImagesDirPath) : null; + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); + String lastUsedBorderImageDirPath = history.getLastSelectedBorderImageDir(); + File lastUsedBorderImageDir = StringUtils.isNotEmpty(lastUsedBorderImageDirPath) ? new File(lastUsedBorderImageDirPath) : null; File inbuiltBorderImagesDir = new File(StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSETS_NAME, "border_images")); - if (lastUsedBorderImagesDir!= null && lastUsedBorderImagesDir.exists()) { - imageFileChooser.setCurrentDirectory(lastUsedBorderImagesDir); + if (lastUsedBorderImageDir!= null && lastUsedBorderImageDir.exists()) { + imageFileChooser.setCurrentDirectory(lastUsedBorderImageDir); } else if (inbuiltBorderImagesDir.exists()) { imageFileChooser.setCurrentDirectory(inbuiltBorderImagesDir); } @@ -232,9 +232,9 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); File selectedDirectory = imageFileChooser.getSelectedFile().getParentFile(); - config.setLastUsedBorderImagesDir(selectedDirectory.getPath()); + history.setLastSelectedBorderImageDir(selectedDirectory.getPath()); } ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index 265de1aba..ee1de8f7e 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/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.mainframe.JForm; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.WidgetTitle; import com.fr.general.Background; @@ -51,7 +52,7 @@ public class LayoutStylePane extends BasicBeanPane { 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 int SETTING_LABEL_WIDTH = 60; + public static final int SETTING_LABEL_WIDTH = 60; protected LayoutBorderStyle style = new LayoutBorderStyle(); @@ -124,7 +125,7 @@ public class LayoutStylePane extends BasicBeanPane { borderStyleCombo = new UIComboBox(BORDER_STYLE); borderLineAndImagePane = new BorderLineAndImagePane(); cornerSpinner = new UISpinner(0,1000,1,0); - backgroundPane = new BackgroundSpecialPane(); + backgroundPane = new LayoutBackgroundSpecialPane(); backgroundOpacityPane = new UIPercentDragPane(); } @@ -229,7 +230,7 @@ public class LayoutStylePane extends BasicBeanPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right") }); - titleBackgroundPane = new BackgroundSpecialPane(); + titleBackgroundPane = new LayoutBackgroundSpecialPane(); titleBackgroundOpacityPane = new UIPercentDragPane(); } @@ -499,4 +500,11 @@ public class LayoutStylePane extends BasicBeanPane { g2d.setColor(oldColor); } } + + protected static class LayoutBackgroundSpecialPane extends BackgroundSpecialPane { + @Override + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + return new GradientBackgroundQuickPane(140); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index 1a207a0b3..b7161cbfb 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/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.event.ActionEvent; 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 @@ -40,7 +44,7 @@ import java.awt.event.ActionListener; * Created by Starryi on 2021/7/3 */ 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 IMAGE_PREVIEW_SIZE = 145; 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(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( new JComponent[][]{ {null, deletableImagePreviewPane}, @@ -110,15 +136,11 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { private void initComponents() { 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.setUI(new BasicButtonUI()); - imageDeleteButton.setOpaque(true); - imageDeleteButton.setBorderPainted(false); - imageDeleteButton.setBorder(null); - imageDeleteButton.setFocusPainted(false); - imageDeleteButton.setContentAreaFilled(true); + imageDeleteButton = new OpaqueColorButton( + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"), + new Color(51, 51, 52, 178), + 2); imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); - imageDeleteButton.setBackground(new Color(51, 51, 51)); imagePreviewPane = new ImagePreviewPane(); imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE); @@ -255,4 +277,35 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { public boolean shouldResponseChangeListener() { 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); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 8df27c19f..c49902c8d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -13,6 +13,7 @@ import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.ComponentUtils; @@ -325,9 +326,7 @@ public class FormDesignerUI extends ComponentUI { } creator.paintBorder(g, creatorBounds); // 拖拽时不绘制 - if (!designer.getStateModel().isDragging()) { - creator.paintSelectedBorderIcon(g, creatorBounds); - } + creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging() && creator.acceptType(XWTitleLayout.class)); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index d8b604e19..b8f3ff638 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/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.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.file.Releasable; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption; @@ -57,7 +56,7 @@ import java.awt.event.MouseEvent; /** * @author null */ -public class FormParaWidgetPane extends JPanel implements Releasable { +public class FormParaWidgetPane extends JPanel { private static FormParaWidgetPane THIS; private final static int BORDER = 5; private final static int WIDGET_WIDTHGAP = 4; @@ -120,15 +119,6 @@ public class FormParaWidgetPane extends JPanel implements Releasable { return THIS; } - public static FormParaWidgetPane getInstance(){ - return THIS; - } - - @Override - public void releaseResources() { - designer = null; - } - public FormParaWidgetPane() { setLayout(new FlowLayout(FlowLayout.LEFT)); DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 60a63a0cc..d792f0eca 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/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.design.dialog.BasicPane; -import com.fr.design.file.Releasable; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -31,7 +30,7 @@ import java.util.List; * Date: 14-7-8 * Time: 下午8:18 */ -public class FormWidgetDetailPane extends FormDockView implements Releasable { +public class FormWidgetDetailPane extends FormDockView{ private static final int ONLINE_TAB = 1; private JPanel centerPane; @@ -62,11 +61,6 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable { private static FormWidgetDetailPane singleton = new FormWidgetDetailPane(); } - @Override - public void releaseResources() { - setEditingFormDesigner(null); - } - public String getViewTitle() { return Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table"); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 856494401..08969c91a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/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.PaperSize; import com.fr.base.Parameter; +import com.fr.base.Releasable; import com.fr.base.extension.FileExtension; import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.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.XCreator; 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.XWAbsoluteBodyLayout; 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.utils.ShareUtils; import com.fr.form.ui.AbstractBorderStyleWidget; +import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; @@ -110,14 +113,13 @@ import java.util.Iterator; import java.util.List; import javax.swing.tree.TreePath; -public class JForm extends JTemplate implements BaseJForm
{ +public class JForm extends JTemplate implements BaseJForm, Releasable { private static final String FORM_CARD = "FORM"; private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD}; private static final int TOOLBARPANEDIMHEIGHT_FORM = 60; - //当前使用的表单设计器 - private static FormDesigner currentFormDesign; + //表单设计器 private FormDesigner formDesign; //格子设计器 @@ -712,7 +714,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm