From d19c63157c2ef1478efe28822a089b98884b7343 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 29 Aug 2017 14:56:17 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3734=20[9.0=E4=B8=80=E8=BD=AE=E5=9B=9E?= =?UTF-8?q?=E5=BD=92]=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=89=93=E4=B8=8D=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/widget/CellWidgetCardPane.java | 6 +++- .../com/fr/design/widget/ValueWidgetPane.java | 11 +++++++ .../com/fr/design/widget/WidgetEventPane.java | 4 +++ .../design/widget/WidgetEventPaneNoPop.java | 25 +++++++++++++++ .../design/widget/WidgetManageCardPane.java | 17 ++++++++++ .../src/com/fr/design/widget/WidgetPane.java | 6 +++- .../com/fr/design/constants/UIConstants.java | 1 + .../design/gui/controlpane/UIControlPane.java | 28 ++++++++++------ .../gui/controlpane/UIListControlPane.java | 32 ++++++++++--------- .../UINameableListCellRenderer.java | 11 +++++-- 10 files changed, 112 insertions(+), 29 deletions(-) create mode 100644 designer/src/com/fr/design/widget/WidgetEventPaneNoPop.java create mode 100644 designer/src/com/fr/design/widget/WidgetManageCardPane.java diff --git a/designer/src/com/fr/design/widget/CellWidgetCardPane.java b/designer/src/com/fr/design/widget/CellWidgetCardPane.java index 1fbe28b5a6..3d135d34c5 100644 --- a/designer/src/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer/src/com/fr/design/widget/CellWidgetCardPane.java @@ -77,7 +77,7 @@ public class CellWidgetCardPane extends BasicPane { attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); initPaneList(); - eventPane = new WidgetEventPane(pane); + eventPane = initWidgetEventPane(pane); eventTabPane.add(eventPane, BorderLayout.CENTER); //k center.add(attriTabPane, Inter.getLocText("FR-Designer_Attribute")); @@ -111,6 +111,10 @@ public class CellWidgetCardPane extends BasicPane { paneList.add(eventPane); } + protected WidgetEventPane initWidgetEventPane(ElementCasePane pane){ + return new WidgetEventPane(pane); + } + @Override protected String title4PopupWindow() { return "Widget"; diff --git a/designer/src/com/fr/design/widget/ValueWidgetPane.java b/designer/src/com/fr/design/widget/ValueWidgetPane.java index 2205f785dc..a705d027a6 100644 --- a/designer/src/com/fr/design/widget/ValueWidgetPane.java +++ b/designer/src/com/fr/design/widget/ValueWidgetPane.java @@ -42,6 +42,17 @@ public class ValueWidgetPane extends WidgetPane { return jPanel; } + protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane){ + return new WidgetManageCardPane(pane); + } + + /** + * 初始化所有事件. + */ + public void initAllListeners() { + + } + @Override public void populate(Widget widget) { super.populate(widget); diff --git a/designer/src/com/fr/design/widget/WidgetEventPane.java b/designer/src/com/fr/design/widget/WidgetEventPane.java index c5a34f5bc6..f1342f9dea 100644 --- a/designer/src/com/fr/design/widget/WidgetEventPane.java +++ b/designer/src/com/fr/design/widget/WidgetEventPane.java @@ -67,6 +67,10 @@ public class WidgetEventPane extends ObjectUIControlPane { public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { private ElementCasePane epane; + // 反射会用到 + public WidgetEventListenerUpdatePane() { + this(null); + } public WidgetEventListenerUpdatePane(ElementCasePane epane){ this.epane = epane; super.initComponents(); diff --git a/designer/src/com/fr/design/widget/WidgetEventPaneNoPop.java b/designer/src/com/fr/design/widget/WidgetEventPaneNoPop.java new file mode 100644 index 0000000000..60597b77be --- /dev/null +++ b/designer/src/com/fr/design/widget/WidgetEventPaneNoPop.java @@ -0,0 +1,25 @@ +package com.fr.design.widget; + +import com.fr.design.mainframe.ElementCasePane; + +import java.awt.*; + +/** + * 没有悬浮弹窗的控件事件编辑面板 + * Created by plough on 2017/8/28. + */ +public class WidgetEventPaneNoPop extends WidgetEventPane { + public WidgetEventPaneNoPop(ElementCasePane ePane) { + super(ePane); + } + + @Override + protected boolean isNewStyle() { + return false; + } + + @Override + protected void popupEditDialog(Point mousePos) { + // no pop, do nothing + } +} diff --git a/designer/src/com/fr/design/widget/WidgetManageCardPane.java b/designer/src/com/fr/design/widget/WidgetManageCardPane.java new file mode 100644 index 0000000000..cf24218aaf --- /dev/null +++ b/designer/src/com/fr/design/widget/WidgetManageCardPane.java @@ -0,0 +1,17 @@ +package com.fr.design.widget; + +import com.fr.design.mainframe.ElementCasePane; + +/** + * Created by kerry on 2017/8/29. + */ +public class WidgetManageCardPane extends CellWidgetCardPane{ + + public WidgetManageCardPane(ElementCasePane pane) { + super(pane); + } + + protected WidgetEventPane initWidgetEventPane(ElementCasePane pane){ + return new WidgetEventPaneNoPop(pane); + } +} diff --git a/designer/src/com/fr/design/widget/WidgetPane.java b/designer/src/com/fr/design/widget/WidgetPane.java index ac7a9ac0e0..fdfba03a23 100644 --- a/designer/src/com/fr/design/widget/WidgetPane.java +++ b/designer/src/com/fr/design/widget/WidgetPane.java @@ -61,7 +61,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener editorTypeComboBox.addItemListener(this); - cellEditorCardPane = new CellWidgetCardPane(pane); + cellEditorCardPane = initWidgetCardPane(pane); this.add(cellEditorCardPane, BorderLayout.CENTER); this.addAttributeChangeListener(listener); } @@ -81,6 +81,10 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener return jPanel; } + protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane){ + return new CellWidgetCardPane(pane); + } + protected JPanel createContentPane() { return new JPanel(); } diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index 758b3bf79a..6b928ebaf7 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -17,6 +17,7 @@ import java.awt.image.BufferedImage; */ public interface UIConstants { + public static final Icon CPT_ICON = BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"); public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif"); public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0); diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index 287c76ffce..4e5fd2bb1c 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -12,6 +12,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; @@ -104,6 +105,11 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH public abstract void saveSettings(); + // 是否使用新样式 + protected boolean isNewStyle() { + return true; + } + protected void initComponentPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.creators = this.createNameableCreators(); @@ -117,15 +123,19 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH UILabel selectLabel = new UILabel(); cardPane.add(selectLabel, "SELECT"); cardPane.add(controlUpdatePane, "EDIT"); - popupEditDialog = new PopupEditDialog(cardPane); - // SplitPane -// JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane); -// mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); -// mainSplitPane.setOneTouchExpandable(true); - - this.add(getLeftPane(), BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 15, 15)); -// mainSplitPane.setDividerLocation(getLeftPreferredSize()); + if (isNewStyle()) { + popupEditDialog = new PopupEditDialog(cardPane); + this.add(getLeftPane(), BorderLayout.CENTER); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 15, 15)); + } else { + // SplitPane + JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane); + mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); + mainSplitPane.setOneTouchExpandable(true); + this.add(mainSplitPane, BorderLayout.CENTER); + mainSplitPane.setDividerLocation(getLeftPreferredSize()); + } + this.checkButtonEnabled(); } diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java index bc49691303..d96862a392 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -106,22 +106,24 @@ public abstract class UIListControlPane extends UIControlPane { } } }); - nameableList.getModel().addListDataListener(new ListDataListener() { - @Override - public void intervalAdded(ListDataEvent e) { - saveSettings(); - } + if (isNewStyle()) { + nameableList.getModel().addListDataListener(new ListDataListener() { + @Override + public void intervalAdded(ListDataEvent e) { + saveSettings(); + } - @Override - public void intervalRemoved(ListDataEvent e) { - saveSettings(); - } + @Override + public void intervalRemoved(ListDataEvent e) { + saveSettings(); + } - @Override - public void contentsChanged(ListDataEvent e) { - saveSettings(); - } - }); + @Override + public void contentsChanged(ListDataEvent e) { + saveSettings(); + } + }); + } } public UINameEdList createJNameList() { @@ -388,7 +390,7 @@ public abstract class UIListControlPane extends UIControlPane { } } - private void popupEditDialog(Point mousePos) { + protected void popupEditDialog(Point mousePos) { Rectangle currentCellBounds = nameableList.getCellBounds(editingIndex, editingIndex); if (editingIndex < 0 || !currentCellBounds.contains(mousePos)) { return; diff --git a/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java index 223ea25a69..9f39e3071b 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java @@ -24,6 +24,7 @@ import java.awt.event.ActionListener; public class UINameableListCellRenderer extends JPanel implements ListCellRenderer { + private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); private static final Color BORDER_COLOR = new Color(201, 198, 184); @@ -49,7 +50,7 @@ public class UINameableListCellRenderer extends return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH); } }; - editButton.setIcon(UIConstants.LIST_EDIT_ICON); + editButton.setIcon(listControlPane.isNewStyle() ? UIConstants.LIST_EDIT_ICON : UIConstants.CPT_ICON); editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR)); editButton.setHorizontalAlignment(SwingConstants.CENTER); label = new UILabel(); @@ -91,13 +92,17 @@ public class UINameableListCellRenderer extends setBackground(bg == null ? list.getSelectionBackground() : bg); setForeground(fg == null ? list.getSelectionForeground() : fg); label.setForeground(Color.WHITE); - editButton.setIcon(UIConstants.LIST_EDIT_WHITE_ICON); + if (listControlPane.isNewStyle()) { + editButton.setIcon(UIConstants.LIST_EDIT_WHITE_ICON); + } } else { setBackground(list.getBackground()); setForeground(list.getForeground()); label.setForeground(initialLabelForeground); - editButton.setIcon(UIConstants.LIST_EDIT_ICON); + if (listControlPane.isNewStyle()) { + editButton.setIcon(UIConstants.LIST_EDIT_ICON); + } } setText((value == null) ? "" : value.toString());