From 3e4390c8b6ddd0d7964af17f73ad1dc619f079f0 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 2 Nov 2017 14:10:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-5284=20=E5=85=AC=E6=B5=8B=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=8F=8D=E9=A6=88=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=85=8D?= =?UTF-8?q?=E8=89=B2=E5=92=8C=E4=BA=A4=E4=BA=92=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=3D>=E4=BF=AE=E6=94=B9=E4=BF=9D=E5=AD=98=E3=80=81?= =?UTF-8?q?=E6=92=A4=E9=94=80=E3=80=81=E6=81=A2=E5=A4=8D=E3=80=81=E5=89=AA?= =?UTF-8?q?=E5=88=87=E3=80=81=E6=8B=B7=E8=B4=9D=E3=80=81=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E3=80=81=E6=A0=BC=E5=BC=8F=E5=88=B7=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/images/buttonicon/redo.png | Bin 421 -> 468 bytes .../com/fr/design/images/buttonicon/save.png | Bin 231 -> 272 bytes .../com/fr/design/images/buttonicon/undo.png | Bin 450 -> 485 bytes .../src/com/fr/design/images/m_edit/copy.png | Bin 214 -> 305 bytes .../src/com/fr/design/images/m_edit/cut.png | Bin 503 -> 617 bytes .../com/fr/design/images/m_edit/formatBrush.png | Bin 428 -> 463 bytes .../src/com/fr/design/images/m_edit/paste.png | Bin 214 -> 279 bytes 7 files changed, 0 insertions(+), 0 deletions(-) diff --git a/designer_base/src/com/fr/design/images/buttonicon/redo.png b/designer_base/src/com/fr/design/images/buttonicon/redo.png index f6b77b4f471dadeb9f02f9d29d26b20f0caf3e9b..b50ad37636c6d3b080ec1ea2a5750b9c5b7a4ef4 100644 GIT binary patch delta 429 zcmV;e0aE^@1JnbMF@KIpL_t(I5uK7TECXQ_$KShNLnP(e#2_NE8pOuZFq58$7%T>3 zEhcHMM`Ea61xpu$)nc&pXoy9E#>`+B1Ix8dgAToWzPszy=dPvkE#Lco@BQERy?;J{ zE|#hrTE0jY delta 381 zcmV-@0fPS21Em9yF@Il4L_t(I5o2JW2QV=)>HYuzKO;7~n6L?=i~ax4P-J3aw#3*t zjTK#vC<7px{zow~p5JC|ZOw~p2v%o-6c`)(axpT#3}ImSZw+*Q8cY)-&=f{S2Cvhn zPrm?(F~cNabVEY})924$ix?QbYyfJG1d1EO^@zC&>V#Mb8< zfPQvG(}az?_3YU*KJYLA+04jDoMxamwhIdjg@a6md*REMFC{>mGmxzUDtrR;?^d9g zE<&7f0WU9i)ZV>&e}croUNAOx;b&z0_y`zSd_YZqfCf!tWo7O^apJ@SkRoGalm8$Z zsJ#8`+0#`JHg<$$0ShyJiiK)E4YV=w%$d_ykre^i{}>sW^3R+(H3dza0c^nk|NlII zHs54rW$`$E{P;U`MU0Hh;b+dAT!StS=bM5EBiU7#JI; z#mYB;G%x}U_zz@Q>kteb(ZK3`{Tsu+bpRAONG$)qo7aYXG_iY<#>1fNh)(0x%kz0q`&Y1rT~T zfc%XNKx)td+yGeUqAMW8$Lj?`nnCgu8vyr0qn{Lm7#}NMOJ9BZ%}~GT8HyTsN<^0000DgV002ovPDHLk FV1jI>S5^Q3 diff --git a/designer_base/src/com/fr/design/images/buttonicon/undo.png b/designer_base/src/com/fr/design/images/buttonicon/undo.png index f86a17441d3dbfa12ccca09d733776079e4e7547..cce0180983e98e1d25a3a7cf938643ee742c386d 100644 GIT binary patch delta 446 zcmV;v0YU!41LXsdF@K*)L_t(I5uH)LF9UHDfA4yNq55MJYz&4nN|0cqX&VuLgTY{J z`eU%PS7Bk$#3I4KU~!EfF{%zme}R~YazYNI44le^Y@PxbPZLAdPH+;EFQO8ppkt-=iv&40KRyKzl}bfGe8K(zz} zp++H6PxA7;->u2cp#Z7E+ayt4<;g+2Xy*99aUWzkuY|oXP94()Jytj9n1x=aXvYXx z=4or0Sm4mkO9s*WU(KR{fcyr~LGnz?wHRch!Bs?Dx0Ao+1Q1WETEePn+<^e8LV3k7 zXqRVszQqb66o0uP#N!981`&B+4MCd9M16P7SI9*CdmagvSpPJO@tL;^E79N(cELEC z<+-&kG`?(^$k-Hla{~dy`FRo0lvrTIWX*5#LK~wRZnMLzU?lWRG&e9y05Xxjl7#X! z<423LVs;^TuS5fLAi$h#c o;4JKf#db(=@^1rSOemjz0Vg?*A&ivaNiQ*GGodRA4Gm>8F)>^6|353$mcKwKebk`w!MJF#LBx7RSeChDn;5no9in^LG!>`PMKoX=!OGDJdBtNlByI z&!6A=4HHME89^L#b92?dfB)?SYF0#+M6em(1KF*Gvw^q(^ZU&Ou0ZlJg`ojIPm}| zo)0v@0O+FAKskO!#!s;zJs1Xn1kao~HHDFpIUK}B2B%M-zRJqV;sG?|=KufyJdou` zVw;(nDFS2e5=olS6$8Vn79@t%3+Rfm^I2A77bj5^02Cf^Z@=GvNcR8$002ovPDHLk FV1h;2ycPfe diff --git a/designer_base/src/com/fr/design/images/m_edit/copy.png b/designer_base/src/com/fr/design/images/m_edit/copy.png index 4d93d0ee5b8b5c344f9a9886e78abc753a155ce0..2b2e21fca7b5bf58322bf9f9ce86f356e8d15f7e 100644 GIT binary patch delta 265 zcmV+k0rvjZ0kHy*F@NhxL_t(I5o7f5^#0F)1=!iz9H^?Qbi^WsDg-hB9e~8rGqV1- zwYBd@RgKAGf(iZqexCt^VW6|Ko#El5#}0%HVS#Btrz0Ywz(NlnK6F5rL*`>OVEeW$ z44z&-aCPY6#Kg$hxNX~(29N>_13=zjtTvgqes=!vYIk9LC4$e~=`xVE_OCvdfV0Q&;B05Y+ zst|-$7n)db*FVse3zwzKLQ^+pAucpx8kCxXf{Th`QPd&bOI?&ARUzih^PWiuUT7a= z-nr-F&ij}US>vjgUoDkNhb^iPLW9R9m0d8IlRLlvF4&xnp?|?+bA1gA(-&jRr04t7 zwh0&LhSXb}bjO~NrMCD zo3+|6I}GgNajDw9CPzPOh;Ya2`rQMqXzhffj0ar~u^Ap1em=g~!HU!J)(v8Hzg2dh za&D$c~=dLXFzVYnCe`B(ZV-YWp-4TF;hC1>}Mqse-8AKsP z7go#3bv@wmY9~!0y$9ZN1}k^mIxFY8D1rP@hGbr2hcCuqgn+?8+w}yY6uiACBDokLMa0)Qt6d3Z9fW-K#?INoui0FAIUz7jg-sfTlzr@EkFUbJ&Gcy#7HiAww97&f zUPxY$(wG6Uf{s@ZP2$TBZ*JV3YPI^<-=9iAHVl3Z{3W!j0|TipaM#Q?G8yMSm&>K= z4lZKE9<)y!!rznEJBVY{nojt_QSIZ6hVVV)J9uH_qDqu<9sjucvV8x21L0$Gv|sol zx%vdLSab=v&-45z9;75KE4oYp?JvHe!fo4yI8QUs2EzDHj@jBEXpnex00000NkvXX Hu0mjf?QPf9 diff --git a/designer_base/src/com/fr/design/images/m_edit/formatBrush.png b/designer_base/src/com/fr/design/images/m_edit/formatBrush.png index c821df52bed10b48c8fd7248ba071a93d3140a7a..9e147853406719e4442c315ea50ac94aa74bc3af 100644 GIT binary patch delta 424 zcmV;Z0ayO41J47HF@K3kL_t(I5o2Z`10-h@85)|J@t;3)@+~8&`jb=hy8r)YC;{nX zWMMI4BE^8Dl>8o;W{^InzyBnNHUOlVf#H8K%tA&+#4|NcQlK{i7*|9=6AFn(Gqa)N=8!IuAX}T^ z|9@?eAkeQs$iNV+b#xApiUt|N@Q>m5oY@mXf$Bk0aKQBcKhr)q50fDeGQ>viK{QAT zT{Bqh|27r&Pk%o?yZ~A$fTXpbK~bt659WM|H%fr$RQl4;0j;R>v))f=rjQ1w1L{D SWDYa{00001FQp(F@I)BL_t(I5o2JW5HOOe-_p{O^Y`!H%m4pp6gqqMv>g*E20%3b z+5G=MgFhqV|92q0EW{ds(EQ(-k&$sPD=SMRNH0-dz@pjr`0?Z4K?dOUf`fwt*oD7- z{aN+@Kip=xW{?5QAi~ttv{_bG_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2=98=E6=A0=8F=E5=8F=AF=E6=8B=96=E5=8A=A8=EF=BC=8C?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E7=B1=BB=E4=BC=BCtab=E5=BC=B9=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UIControlPane.java | 117 +++++++++++++++++- .../gui/controlpane/UIListControlPane.java | 4 + 2 files changed, 118 insertions(+), 3 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 f92f7201a..d1673d47a 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -15,11 +15,12 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; +import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.border.EmptyBorder; import java.awt.*; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import java.awt.event.*; /** * Created by plough on 2017/7/21. @@ -313,15 +314,18 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH // 点击"编辑"按钮,弹出面板 protected class PopupEditDialog extends JDialog { private JComponent editPane; + private PopupToolPane popupToolPane; private static final int WIDTH = 570; private static final int HEIGHT = 490; - PopupEditDialog(JComponent pane) { + public PopupEditDialog(JComponent pane) { super(DesignerContext.getDesignerFrame()); setUndecorated(true); pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); this.editPane = pane; JPanel editPaneWrapper = new JPanel(new BorderLayout()); + popupToolPane = new PopupToolPane(this); + editPaneWrapper.add(popupToolPane, BorderLayout.NORTH); editPaneWrapper.add(editPane, BorderLayout.CENTER); editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1)); this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER); @@ -331,6 +335,10 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH initListener(); } + public void setTitle(String title) { + popupToolPane.setTitle(title); + } + private void hideDialog() { // 检查是否有子弹窗,如果有,则不隐藏 for (Window window : getOwnedWindows()) { @@ -358,4 +366,107 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH }); } } + + // 移动弹出编辑面板的工具条 + private class PopupToolPane extends JPanel { + private JDialog parentDialog; // 如果不在对话框中,值为null + private Color originColor; // 初始背景 + private JPanel contentPane; + private UILabel titleLabel; + private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到 + + private static final int MIN_X = -150; + private static final int MAX_X_SHIFT = 50; + private static final int MAX_Y_SHIFT = 50; + + private MouseListener mouseListener = new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + if (mouseDownCompCoords == null) { + contentPane.setBackground(originColor); + } + repaint(); + } + @Override + public void mouseReleased(MouseEvent e) { + mouseDownCompCoords = null; + if (!getBounds().contains(e.getPoint())) { + contentPane.setBackground(originColor); + } + } + @Override + public void mousePressed(MouseEvent e) { + mouseDownCompCoords = e.getPoint(); + } + }; + + private MouseMotionListener mouseMotionListener = new MouseMotionListener() { + @Override + public void mouseMoved(MouseEvent e) { + setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); + contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND); + repaint(); + } + @Override + public void mouseDragged(MouseEvent e) { + if (mouseDownCompCoords != null) { + Point currCoords = e.getLocationOnScreen(); + int x = currCoords.x - mouseDownCompCoords.x; + int y = currCoords.y - mouseDownCompCoords.y; + //屏幕可用区域 + Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + + int minY = screen.y; + int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT; + int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT; + if (x < MIN_X) { + x = MIN_X; + } else if (x > maxX) { + x = maxX; + } + if (y < minY) { + y = minY; + } else if (y > maxY) { + y = maxY; + } + // 移动到屏幕边缘时,需要校正位置 + parentDialog.setLocation(x, y); + } + } + }; + + public PopupToolPane(JDialog parentDialog) { + this(StringUtils.EMPTY, parentDialog); + } + + public PopupToolPane(String title, JDialog parentDialog) { + super(); + this.parentDialog = parentDialog; + originColor = UIConstants.UI_TOOLBAR_COLOR; + + contentPane = new JPanel(); + contentPane.setBackground(originColor); + contentPane.setLayout(new BorderLayout()); + titleLabel = new UILabel(title); + contentPane.add(titleLabel, BorderLayout.WEST); + contentPane.setBorder(new EmptyBorder(5, 10, 5, 0)); + + setLayout(new BorderLayout()); + add(contentPane, BorderLayout.CENTER); + setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); + + addMouseListener(mouseListener); + addMouseMotionListener(mouseMotionListener); + } + + public void setTitle(String title) { + titleLabel.setText(title); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, 25); + } + } } \ 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 a148fd3b8..12b25586d 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -407,6 +407,9 @@ public abstract class UIListControlPane extends UIControlPane { return; } popupEditDialog.setLocation(getPopupDialogLocation()); + if (popupEditDialog instanceof PopupEditDialog) { + ((PopupEditDialog)popupEditDialog).setTitle(selectedName); + } popupEditDialog.setVisible(true); } } @@ -773,6 +776,7 @@ public abstract class UIListControlPane extends UIControlPane { nameableList.editItemAt(nameableList.getSelectedIndex()); } else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) { editingIndex = nameableList.getSelectedIndex(); + selectedName = nameableList.getNameAt(editingIndex); popupEditDialog(evt.getPoint()); } From 7949cb2ecfbf51b569b7b3c542c1420030ea67e3 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 2 Nov 2017 17:02:42 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-5284=20=E5=85=AC=E6=B5=8B=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=8F=8D=E9=A6=88=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=85=8D?= =?UTF-8?q?=E8=89=B2=E5=92=8C=E4=BA=A4=E4=BA=92=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=3D>=E7=82=B9=E5=87=BB=E6=B7=BB=E5=8A=A0=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=88=96=E8=80=85=E6=B7=BB=E5=8A=A0=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E3=80=81=E8=B6=85=E9=93=BE=E7=9A=84=E6=97=B6=E5=80=99=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=89=93=E5=BC=80=E6=96=B0=E5=BB=BA=E9=A1=B9=E7=9A=84?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/controlpane/UIListControlPane.java | 11 ++++++++--- 1 file changed, 8 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 12b25586d..cd8b48d41 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -330,6 +330,7 @@ public abstract class UIListControlPane extends UIControlPane { nameableList.ensureIndexIsVisible(index); nameEdList.repaint(); + popupEditDialog(); } /** @@ -400,15 +401,19 @@ public abstract class UIListControlPane extends UIControlPane { } } + private void popupEditDialog() { + popupEditDialog(null); + } + protected void popupEditDialog(Point mousePos) { if (isNewStyle()) { Rectangle currentCellBounds = nameableList.getCellBounds(editingIndex, editingIndex); - if (editingIndex < 0 || !currentCellBounds.contains(mousePos)) { + if (editingIndex < 0 || (mousePos != null && !currentCellBounds.contains(mousePos))) { return; } popupEditDialog.setLocation(getPopupDialogLocation()); if (popupEditDialog instanceof PopupEditDialog) { - ((PopupEditDialog)popupEditDialog).setTitle(selectedName); + ((PopupEditDialog)popupEditDialog).setTitle(getSelectedName()); } popupEditDialog.setVisible(true); } @@ -418,7 +423,7 @@ public abstract class UIListControlPane extends UIControlPane { Point resultPos = new Point(0, 0); Point listPos = nameableList.getLocationOnScreen(); resultPos.x = listPos.x - popupEditDialog.getWidth(); - resultPos.y = listPos.y + (editingIndex - 1) * EDIT_RANGE; + resultPos.y = listPos.y + (nameableList.getSelectedIndex() - 1) * EDIT_RANGE; // 当对象在屏幕上的位置比较靠下时,往下移动弹窗至与属性面板平齐 Window frame = DesignerContext.getDesignerFrame();