Browse Source

Merge pull request #1405 in BA/design from ~PLOUGH/design:release/9.0 to release/9.0

* commit '9b0415da3747ebffea1c15de038f5af4e15de030':
  REPORT-5284 公测客户反馈设计器配色和交互问题修改=>点击添加事件或者添加条件、超链的时候直接打开新建项的弹窗
  REPORT-5284 公测客户反馈设计器配色和交互问题修改=>控件事件、条件、超链的弹窗增加标题栏;标题栏可拖动,交互类似tab弹出
  REPORT-5284 公测客户反馈设计器配色和交互问题修改=>修改保存、撤销、恢复、剪切、拷贝、粘贴、格式刷图标
master
superman 7 years ago
parent
commit
564f559b26
  1. 117
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  2. 13
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  3. BIN
      designer_base/src/com/fr/design/images/buttonicon/redo.png
  4. BIN
      designer_base/src/com/fr/design/images/buttonicon/save.png
  5. BIN
      designer_base/src/com/fr/design/images/buttonicon/undo.png
  6. BIN
      designer_base/src/com/fr/design/images/m_edit/copy.png
  7. BIN
      designer_base/src/com/fr/design/images/m_edit/cut.png
  8. BIN
      designer_base/src/com/fr/design/images/m_edit/formatBrush.png
  9. BIN
      designer_base/src/com/fr/design/images/m_edit/paste.png

117
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.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.WindowAdapter; import java.awt.event.*;
import java.awt.event.WindowEvent;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -313,15 +314,18 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
// 点击"编辑"按钮,弹出面板 // 点击"编辑"按钮,弹出面板
protected class PopupEditDialog extends JDialog { protected class PopupEditDialog extends JDialog {
private JComponent editPane; private JComponent editPane;
private PopupToolPane popupToolPane;
private static final int WIDTH = 570; private static final int WIDTH = 570;
private static final int HEIGHT = 490; private static final int HEIGHT = 490;
PopupEditDialog(JComponent pane) { public PopupEditDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
setUndecorated(true); setUndecorated(true);
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
this.editPane = pane; this.editPane = pane;
JPanel editPaneWrapper = new JPanel(new BorderLayout()); JPanel editPaneWrapper = new JPanel(new BorderLayout());
popupToolPane = new PopupToolPane(this);
editPaneWrapper.add(popupToolPane, BorderLayout.NORTH);
editPaneWrapper.add(editPane, BorderLayout.CENTER); editPaneWrapper.add(editPane, BorderLayout.CENTER);
editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1)); editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1));
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER); this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER);
@ -331,6 +335,10 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
initListener(); initListener();
} }
public void setTitle(String title) {
popupToolPane.setTitle(title);
}
private void hideDialog() { private void hideDialog() {
// 检查是否有子弹窗,如果有,则不隐藏 // 检查是否有子弹窗,如果有,则不隐藏
for (Window window : getOwnedWindows()) { 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);
}
}
} }

13
designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java

@ -330,6 +330,7 @@ public abstract class UIListControlPane extends UIControlPane {
nameableList.ensureIndexIsVisible(index); nameableList.ensureIndexIsVisible(index);
nameEdList.repaint(); nameEdList.repaint();
popupEditDialog();
} }
/** /**
@ -400,13 +401,20 @@ public abstract class UIListControlPane extends UIControlPane {
} }
} }
private void popupEditDialog() {
popupEditDialog(null);
}
protected void popupEditDialog(Point mousePos) { protected void popupEditDialog(Point mousePos) {
if (isNewStyle()) { if (isNewStyle()) {
Rectangle currentCellBounds = nameableList.getCellBounds(editingIndex, editingIndex); Rectangle currentCellBounds = nameableList.getCellBounds(editingIndex, editingIndex);
if (editingIndex < 0 || !currentCellBounds.contains(mousePos)) { if (editingIndex < 0 || (mousePos != null && !currentCellBounds.contains(mousePos))) {
return; return;
} }
popupEditDialog.setLocation(getPopupDialogLocation()); popupEditDialog.setLocation(getPopupDialogLocation());
if (popupEditDialog instanceof PopupEditDialog) {
((PopupEditDialog)popupEditDialog).setTitle(getSelectedName());
}
popupEditDialog.setVisible(true); popupEditDialog.setVisible(true);
} }
} }
@ -415,7 +423,7 @@ public abstract class UIListControlPane extends UIControlPane {
Point resultPos = new Point(0, 0); Point resultPos = new Point(0, 0);
Point listPos = nameableList.getLocationOnScreen(); Point listPos = nameableList.getLocationOnScreen();
resultPos.x = listPos.x - popupEditDialog.getWidth(); 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(); Window frame = DesignerContext.getDesignerFrame();
@ -773,6 +781,7 @@ public abstract class UIListControlPane extends UIControlPane {
nameableList.editItemAt(nameableList.getSelectedIndex()); nameableList.editItemAt(nameableList.getSelectedIndex());
} else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) { } else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) {
editingIndex = nameableList.getSelectedIndex(); editingIndex = nameableList.getSelectedIndex();
selectedName = nameableList.getNameAt(editingIndex);
popupEditDialog(evt.getPoint()); popupEditDialog(evt.getPoint());
} }

BIN
designer_base/src/com/fr/design/images/buttonicon/redo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 468 B

BIN
designer_base/src/com/fr/design/images/buttonicon/save.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 272 B

BIN
designer_base/src/com/fr/design/images/buttonicon/undo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 485 B

BIN
designer_base/src/com/fr/design/images/m_edit/copy.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 305 B

BIN
designer_base/src/com/fr/design/images/m_edit/cut.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 617 B

BIN
designer_base/src/com/fr/design/images/m_edit/formatBrush.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 463 B

BIN
designer_base/src/com/fr/design/images/m_edit/paste.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 279 B

Loading…
Cancel
Save