From d26b8c1a56497f44a00fd07f9af0d7d5b84d0c24 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 24 Jul 2017 17:35:17 +0800 Subject: [PATCH 01/21] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E6=9D=BF=3D=E3=80=8B=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=A9=BA=E7=99=BD=E5=A4=84=E4=B9=9F=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E7=BC=96=E8=BE=91=E6=A1=86=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/controlpane/UIListControlPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 c082f6698..893bd9581 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -358,8 +358,8 @@ public abstract class UIListControlPane extends UIControlPane { } } - private void popupEditPane() { - if (editingIndex < 0) { + private void popupEditPane(Point mousePos) { + if (editingIndex < 0 || !nameableList.getCellBounds(editingIndex, editingIndex).contains(mousePos)) { return; } GUICoreUtils.showPopupMenu(popupEditPane, this, @@ -669,7 +669,7 @@ public abstract class UIListControlPane extends UIControlPane { nameableList.editItemAt(nameableList.getSelectedIndex()); } else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) { editingIndex = nameableList.getSelectedIndex(); - popupEditPane(); + popupEditPane(evt.getPoint()); } // peter:处理右键的弹出菜单 From 38f3380c67076811111d1199cb9e8d992c77fed8 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 24 Jul 2017 18:30:05 +0800 Subject: [PATCH 02/21] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E6=9D=BF=3D=E3=80=8B=E8=AE=A9=E5=AD=90?= =?UTF-8?q?=E7=B1=BB=E9=87=8D=E5=86=99=E6=A0=87=E7=AD=BE=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/gui/controlpane/UIControlPane.java | 9 ++++++++- .../src/com/fr/design/gui/frpane/HyperlinkGroupPane.java | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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 8878cd43a..632889bba 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -155,7 +155,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH double[] columnSize = { p, f }; double[] rowSize = { p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel("add hyperlink "), topToolBar}, + new Component[]{new UILabel(getAddItemText()), topToolBar}, }; JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); @@ -164,6 +164,13 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH return leftPane; } + /** + * 子类重写此方法,可以改变标签内容 + */ + protected String getAddItemText() { + return "add item "; + } + /** * 初始化左边面板 */ diff --git a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java index fcd9ba383..e2932fbe6 100644 --- a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -53,6 +53,11 @@ public abstract class HyperlinkGroupPane extends UIListControlPane { return Inter.getLocText("FR-Designer_Hyperlink"); } + @Override + protected String getAddItemText() { + return "add hyperlink"; + } + public void populate(NameJavaScriptGroup nameHyperlink_array) { java.util.List list = new ArrayList(); if (nameHyperlink_array != null) { From 1a47a1fc774e22c6ddb6b4f7693a9f7472d3b873 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 25 Jul 2017 14:28:35 +0800 Subject: [PATCH 03/21] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E6=9D=BF=3D=E3=80=8B=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E5=BC=B9=E7=AA=97=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UIControlPane.java | 67 +++++++++---------- .../gui/controlpane/UIListControlPane.java | 10 +-- .../UINameableListCellRenderer.java | 2 +- .../mainframe/EastRegionContainerPane.java | 39 +++++++++-- 4 files changed, 69 insertions(+), 49 deletions(-) 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 632889bba..b11dafba4 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -6,16 +6,15 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.EastRegionContainerPane; +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.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import javax.swing.*; import java.awt.*; +import java.awt.event.*; /** * Created by plough on 2017/7/21. @@ -29,7 +28,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH private ToolBarDef toolbarDef; private UIToolbar toolBar; - protected PopupEditPane popupEditPane; + protected PopupEditDialog popupEditDialog; // peter:这是整体的一个cardLayout Pane protected CardLayout cardLayout; @@ -103,7 +102,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH UILabel selectLabel = new UILabel(); cardPane.add(selectLabel, "SELECT"); cardPane.add(controlUpdatePane, "EDIT"); - popupEditPane = new PopupEditPane(cardPane); + popupEditDialog = new PopupEditDialog(cardPane); // SplitPane // JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane); // mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); @@ -185,7 +184,6 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH protected ShortCut4JControlPane[] createShortcuts() { return new ShortCut4JControlPane[]{ -// addItemShortCut(), copyItemShortCut(), moveUpItemShortCut(), moveDownItemShortCut(), @@ -250,44 +248,39 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH } // 点击"编辑"按钮,弹出面板 - protected class PopupEditPane extends JPopupMenu { - private JComponent contentPane; + protected class PopupEditDialog extends JDialog { + private JComponent editPane; private static final int WIDTH = 460; private static final int HEIGHT = 500; - // private PopupToolPane popupToolPane; -// private int fixedHeight; - - PopupEditPane(JComponent pane) { - contentPane = pane; - this.setLayout(new BorderLayout()); - this.add(contentPane, BorderLayout.CENTER); - this.setOpaque(false); - contentPane.setPreferredSize(new Dimension(WIDTH, HEIGHT)); -// fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height; -// updateSize(); - } - -// private void updateSize() { -// int newHeight = fixedHeight + contentPane.getPreferredSize().height; -// this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight)); -// } - public JComponent getContentPane() { - return contentPane; + PopupEditDialog(JComponent pane) { + super(DesignerContext.getDesignerFrame()); + setUndecorated(true); + this.editPane = pane; + this.getContentPane().add(editPane, BorderLayout.CENTER); + setSize(WIDTH, HEIGHT); + this.setVisible(false); + initListener(); } - public void replaceContentPane(JComponent pane) { -// remove(pane); - this.remove(this.contentPane); - this.add(this.contentPane = pane); -// updateSize(); - refreshContainer(); + private void hideDialog() { + // 检查是否有子弹窗,如果有,则不隐藏 + for (Window window : getOwnedWindows()) { + if (window.isVisible()) { + return; + } + } + setVisible(false); } - private void refreshContainer() { - validate(); - repaint(); - revalidate(); + private void initListener() { + addWindowFocusListener(new WindowAdapter() { + @Override + public void windowLostFocus(WindowEvent e) { + super.windowLostFocus(e); + hideDialog(); + } + }); } } } \ No newline at end of file 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 893bd9581..76be4f96d 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -26,10 +26,8 @@ import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.core.PropertyChangeAdapter; -import sun.swing.DefaultLookup; import javax.swing.*; -import javax.swing.border.Border; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; @@ -359,11 +357,13 @@ public abstract class UIListControlPane extends UIControlPane { } private void popupEditPane(Point mousePos) { - if (editingIndex < 0 || !nameableList.getCellBounds(editingIndex, editingIndex).contains(mousePos)) { + Rectangle currentCellBounds = nameableList.getCellBounds(editingIndex, editingIndex); + if (editingIndex < 0 || !currentCellBounds.contains(mousePos)) { return; } - GUICoreUtils.showPopupMenu(popupEditPane, this, - - popupEditPane.getPreferredSize().width, editingIndex * EDIT_RANGE); + Point listPos = nameableList.getLocationOnScreen(); + popupEditDialog.setLocation(listPos.x - popupEditDialog.getSize().width, listPos.y + editingIndex * EDIT_RANGE); + popupEditDialog.setVisible(true); } /** 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 e56b03807..70801736a 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java @@ -54,7 +54,7 @@ public class UINameableListCellRenderer extends // editButton.addActionListener(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { -// popupEditPane(); +// popupEditDialog(); // } // }); label = new UILabel(); diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index a0a3b8828..7f96747d5 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -27,6 +27,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private CardLayout propertyCard; private JPanel leftPane; private JPanel rightPane; + private FixedPopupPane currentPopupPane; private static final int CONTAINER_WIDTH = 260; private static final int TAB_WIDTH = 40; private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; @@ -381,6 +382,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return 0; } + private void hideCurrentPopupPane() { + if (currentPopupPane != null && currentPopupPane.isVisible()) { + currentPopupPane.setVisible(false); + } + } + class PropertyItem { @@ -473,7 +480,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyPanel.remove(this.contentPane); propertyPanel.add(this.contentPane = pane); if (popupDialog != null && isPoppedOut) { - popupDialog.replaceContentPane(contentPane); + popupDialog.replaceContentPane(this); } if (popupPane != null && !isRightPaneVisible()) { popupPane.replaceContentPane(contentPane); @@ -488,6 +495,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void onResize() { if (isRightPaneVisible()) { + hideCurrentPopupPane(); replaceContentPane(contentPane); } else if(popupPane != null) { popupPane.replaceContentPane(contentPane); @@ -540,7 +548,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (popupPane == null) { popupPane = new FixedPopupPane(this); } - GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); + if (popupPane.isVisible()) { + popupPane.setVisible(false); + } else { + hideCurrentPopupPane(); + currentPopupPane = popupPane; + GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); + } } // 弹出对话框 @@ -553,7 +567,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (popupDialog == null) { popupDialog = new PopupDialog(this); } else { - popupDialog.replaceContentPane(contentPane); + popupDialog.replaceContentPane(this); + popupDialog.adjustLocation(); popupDialog.setVisible(true); } // initContentPane(); @@ -588,6 +603,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { updateSize(); } + public void menuSelectionChanged(boolean isIncluded) { + } + private void updateSize() { int newHeight = fixedHeight + contentPane.getPreferredSize().height; this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight)); @@ -795,10 +813,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private Point mouseDownCompCoords; private int minHeight; // 对话框最小高度 private JComponent contentPane; + private PropertyItem propertyItem; public PopupDialog(PropertyItem propertyItem) { super(DesignerContext.getDesignerFrame()); container = getContentPane(); setUndecorated(true); + this.propertyItem = propertyItem; PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON); popupToolPane.setParentDialog(this); contentPane = propertyItem.getContentPane(); @@ -807,13 +827,20 @@ public class EastRegionContainerPane extends UIEastResizableContainer { minHeight = container.getPreferredSize().height; setSize(CONTENT_WIDTH, minHeight); // validate(); - Point btnCoords = propertyItem.getButton().getLocationOnScreen(); - this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y); + adjustLocation(); initListener(); this.setVisible(true); } - public void replaceContentPane(JComponent contentPane) { + + public void adjustLocation() { + Point btnCoords = propertyItem.getButton().getLocationOnScreen(); + this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y); + } + + public void replaceContentPane(PropertyItem propertyItem) { + this.propertyItem = propertyItem; + JComponent contentPane = propertyItem.getContentPane(); container.remove(this.contentPane); container.add(this.contentPane = contentPane); // pack(); From 671a35a4f68763829bf0d8c884279b64c3d3e4b8 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 25 Jul 2017 15:32:29 +0800 Subject: [PATCH 04/21] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E6=9D=BF=3D=E3=80=8B=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BC=B9=E5=87=BA=E6=A1=86=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/controlpane/UIListControlPane.java | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) 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 76be4f96d..e2ca3d608 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -15,6 +15,7 @@ import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; @@ -356,16 +357,47 @@ public abstract class UIListControlPane extends UIControlPane { } } - private void popupEditPane(Point mousePos) { + private void popupEditDialog(Point mousePos) { Rectangle currentCellBounds = nameableList.getCellBounds(editingIndex, editingIndex); if (editingIndex < 0 || !currentCellBounds.contains(mousePos)) { return; } - Point listPos = nameableList.getLocationOnScreen(); - popupEditDialog.setLocation(listPos.x - popupEditDialog.getSize().width, listPos.y + editingIndex * EDIT_RANGE); + popupEditDialog.setLocation(getPopupDialogLocation()); popupEditDialog.setVisible(true); } + private Point getPopupDialogLocation() { + Point resultPos = new Point(0, 0); + Point listPos = nameableList.getLocationOnScreen(); + resultPos.x = listPos.x - popupEditDialog.getWidth(); + resultPos.y = listPos.y + (editingIndex - 1) * EDIT_RANGE; + + // 当对象在屏幕上的位置比较靠下时,往下移动弹窗至与属性面板平齐 + Window frame = DesignerContext.getDesignerFrame(); + // 不能太低 + int maxY = frame.getLocationOnScreen().y + frame.getHeight() - popupEditDialog.getHeight(); + if (resultPos.y > maxY) { + resultPos.y = maxY; + } + // 也不能太高 + int minY = frame.getLocationOnScreen().y + EDIT_RANGE; + if (resultPos.y < minY) { + resultPos.y = minY; + } + + // 当在左侧显示不下时,在右侧弹出弹窗 + if (resultPos.x < 0) { + resultPos.x = listPos.x + nameableList.getParent().getWidth(); + } + // 如果右侧显示不下,可以向左移动 + int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - popupEditDialog.getWidth() - EDIT_RANGE; + if (resultPos.x > maxX) { + resultPos.x = maxX; + } + + return resultPos; + } + /** * 增加项的UpdateAction */ @@ -669,7 +701,7 @@ public abstract class UIListControlPane extends UIControlPane { nameableList.editItemAt(nameableList.getSelectedIndex()); } else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) { editingIndex = nameableList.getSelectedIndex(); - popupEditPane(evt.getPoint()); + popupEditDialog(evt.getPoint()); } // peter:处理右键的弹出菜单 From 5810601058b9227c4a55fd4a4e208556ee5e206a Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 25 Jul 2017 15:48:46 +0800 Subject: [PATCH 05/21] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E6=9D=BF=3D=E3=80=8B=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=88=97=E8=A1=A8=E9=A1=B9=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=8F=B0=E6=8A=A5=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UINameableListCellRenderer.java | 6 ------ designer_base/src/com/fr/design/gui/ilist/UIList.java | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) 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 70801736a..8da13e681 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java @@ -143,18 +143,12 @@ public class UINameableListCellRenderer extends Nameable wrappee = ((ListModelElement) value).wrapper; this.setText(((ListModelElement) value).wrapper.getName()); - boolean iconSet = false; for (NameableCreator creator : listControlPane.creators()) { if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) { -// this.setIcon(creator.menuIcon()); this.setToolTipText(creator.createTooltip()); - iconSet = true; break; } } -// if (!iconSet) { -// this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png")); -// } } return this; diff --git a/designer_base/src/com/fr/design/gui/ilist/UIList.java b/designer_base/src/com/fr/design/gui/ilist/UIList.java index 8916cf18c..34a3a48d0 100644 --- a/designer_base/src/com/fr/design/gui/ilist/UIList.java +++ b/designer_base/src/com/fr/design/gui/ilist/UIList.java @@ -1,6 +1,7 @@ package com.fr.design.gui.ilist; import com.fr.data.core.db.TableProcedure; +import com.fr.design.gui.controlpane.UINameableListCellRenderer; import com.fr.design.gui.itooltip.UIToolTip; import com.fr.design.mainframe.JTemplate; import com.fr.stable.StringUtils; @@ -43,6 +44,10 @@ public class UIList extends JList { Object value = getModel().getElementAt(index); ListCellRenderer renderer = getCellRenderer(); Component rendererComp = renderer.getListCellRendererComponent(this, value, index, true, false); + // UINameableListCellRenderer 继承自JPanel,无法强转为JLabel,直接返回即可 + if (rendererComp instanceof UINameableListCellRenderer) { + return null; + } if (rendererComp.getPreferredSize().width > getVisibleRect().width) { String tips = (rendererComp instanceof JComponent) ? ((JComponent) rendererComp).getToolTipText() : null; if (tips == null) { From ff6ce7bcbb1839161f7f5d45822fbfd0a4494cb6 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 25 Jul 2017 16:30:03 +0800 Subject: [PATCH 06/21] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=3D=E3=80=8B=E8=B0=83=E6=95=B4=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=EF=BC=8C=E7=A1=AE=E4=BF=9D=E5=AD=90=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/gui/controlpane/UIControlPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 b11dafba4..c558f0b68 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -250,8 +250,8 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH // 点击"编辑"按钮,弹出面板 protected class PopupEditDialog extends JDialog { private JComponent editPane; - private static final int WIDTH = 460; - private static final int HEIGHT = 500; + private static final int WIDTH = 470; + private static final int HEIGHT = 550; PopupEditDialog(JComponent pane) { super(DesignerContext.getDesignerFrame()); @@ -259,6 +259,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH this.editPane = pane; this.getContentPane().add(editPane, BorderLayout.CENTER); setSize(WIDTH, HEIGHT); +// pack(); this.setVisible(false); initListener(); } From c3d30e3a251518cd7009fe2bc85b93b973d7bffa Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 25 Jul 2017 17:43:31 +0800 Subject: [PATCH 07/21] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=3D=E3=80=8B=E5=AE=9E=E6=97=B6=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/ReportHyperlinkGroupPane.java | 50 +++++++++++++++++++ .../design/gui/controlpane/UIControlPane.java | 3 ++ .../gui/controlpane/UIListControlPane.java | 4 ++ .../design/gui/frpane/HyperlinkGroupPane.java | 1 + 4 files changed, 58 insertions(+) diff --git a/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java b/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java index 64c397da1..841e6c6e0 100644 --- a/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java +++ b/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java @@ -1,6 +1,10 @@ package com.fr.design.mainframe; +import com.fr.base.Style; +import com.fr.design.actions.utils.ReportActionUtils; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.frpane.HyperlinkGroupPane; +import com.fr.general.FRFont; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; @@ -8,6 +12,9 @@ import com.fr.js.NameJavaScriptGroup; import com.fr.report.cell.CellElement; import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; +import com.fr.stable.Constants; + +import java.awt.*; /** * Created by plough on 2017/7/21. @@ -23,9 +30,21 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { if (singleton == null) { singleton = new ReportHyperlinkGroupPane(); } + singleton.refreshPane(); return singleton; } + private void refreshPane() { + ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); + if (reportPane == null) { + return; + } +// + final TemplateElementCase report = reportPane.getEditingElementCase(); + NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); + populate(nameHyperlinks); + } + public void populate(ElementCasePane reportPane) { // TemplateElementCase elementCase = ePane.getEditingElementCase(); // if (elementCase == null) { @@ -52,4 +71,35 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { return nameHyperlinks; } + + @Override + public void saveSettings() { + ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); + if (reportPane == null) { + return; + } + final TemplateElementCase report = reportPane.getEditingElementCase(); + final Selection sel = reportPane.getSelection(); + final NameJavaScriptGroup updateNameHyperlinks = updateJSGroup(); + if (sel instanceof FloatSelection) { + FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName()); + selectedFloatElement.setNameHyperlinkGroup(updateNameHyperlinks); + } else { + ReportActionUtils.actionIterateWithCellSelection((CellSelection)sel, report, new ReportActionUtils.IterAction() { + public void dealWith(CellElement editCellElement) { + Style elementStyle = editCellElement.getStyle(); + FRFont frFont = elementStyle.getFRFont(); + if (updateNameHyperlinks.size() > 0) { + frFont = frFont.applyForeground(Color.blue); + frFont = frFont.applyUnderline(Constants.LINE_THIN); + } else { + frFont = frFont.applyForeground(Color.black); + frFont = frFont.applyUnderline(Constants.LINE_NONE); + } + editCellElement.setStyle(elementStyle.deriveFRFont(frFont)); + editCellElement.setNameHyperlinkGroup(updateNameHyperlinks); + } + }); + } + } } 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 c558f0b68..c47f8b195 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -89,6 +89,8 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH this.cardPane = cardPane; } + public abstract void saveSettings(); + protected void initComponentPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.creators = this.createNameableCreators(); @@ -271,6 +273,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH return; } } + saveSettings(); setVisible(false); } 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 e2ca3d608..9c82ffbe9 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -36,6 +36,8 @@ import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -92,6 +94,8 @@ public abstract class UIListControlPane extends UIControlPane { ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).update(); ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate(); UIListControlPane.this.checkButtonEnabled(); + // plough:感觉每次valueChange都保存一下,会稍微影响效率 + saveSettings(); } } }); diff --git a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java index e2932fbe6..97e6e2245 100644 --- a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -5,6 +5,7 @@ import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; import com.fr.general.NameObject; From 8e34056d1ab20e38a0f353f2b7433ef2fc002e72 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 25 Jul 2017 18:00:05 +0800 Subject: [PATCH 08/21] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=B1=9E=E6=80=A7-=E6=A0=B7=E5=BC=8F=3D=E3=80=8B=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F=3D=E3=80=8B=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=E3=80=81=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cell/settingpane/CellExpandAttrPane.java | 15 - .../settingpane/style/CustomStylePane.java | 287 ++++---- .../design/gui/ibutton/FiveButtonLayout.java | 22 +- .../com/fr/design/gui/ibutton/UITabGroup.java | 2 +- .../fr/design/gui/style/AlignmentPane.java | 686 +++++++++--------- .../com/fr/design/gui/style/BorderPane.java | 386 +++++----- .../com/fr/design/gui/style/FRFontPane.java | 47 +- .../com/fr/design/gui/style/FormatPane.java | 55 +- .../com/fr/design/locale/designer.properties | 17 + .../design/locale/designer_en_US.properties | 17 + .../design/locale/designer_ja_JP.properties | 58 +- .../design/locale/designer_ko_KR.properties | 56 +- .../design/locale/designer_zh_CN.properties | 17 + .../design/locale/designer_zh_TW.properties | 58 +- 14 files changed, 913 insertions(+), 810 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java index 128c01418..3ca8bff0c 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java @@ -89,21 +89,6 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { layoutPane.add(basicPane,BorderLayout.NORTH); layoutPane.add(seniorPane,BorderLayout.CENTER); return layoutPane; -// double f = TableLayout.FILL; -// double p = TableLayout.PREFERRED; -// Component[][] components = new Component[][]{ -// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton}, -// new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane}, -// new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane}, -// new Component[]{new JSeparator(), null}, -// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox}, -// new Component[]{null, verticalExpandableCheckBox}, -// new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand}, -// }; -// double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p}; -// double[] columnSize = {p, f}; -// int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}}; -// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); } private JPanel basicPane(){ diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java index 7caadd105..019417c09 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java @@ -1,29 +1,25 @@ package com.fr.design.mainframe.cell.settingpane.style; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.event.ChangeListener; - import com.fr.base.CellBorderStyle; import com.fr.base.NameStyle; import com.fr.base.Style; import com.fr.design.actions.utils.ReportActionUtils; -import com.fr.design.gui.ibutton.FiveButtonLayout; -import com.fr.design.gui.style.AbstractBasicStylePane; -import com.fr.design.gui.style.AlignmentPane; -import com.fr.design.gui.style.BackgroundPane; -import com.fr.design.gui.style.BorderPane; -import com.fr.design.gui.style.FRFontPane; -import com.fr.design.gui.style.FormatPane; -import com.fr.design.style.BorderUtils; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.MultiTabPane; -import com.fr.general.Inter; +import com.fr.design.gui.ibutton.FiveButtonLayout; +import com.fr.design.gui.style.*; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.style.BorderUtils; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; import com.fr.stable.Constants; +import javax.swing.*; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + /** * 哎,复杂的原型图导致复杂的画法。非我所愿也 @@ -32,130 +28,143 @@ import com.fr.stable.Constants; * @since 2012-5-24上午10:36:10 */ public class CustomStylePane extends MultiTabPane