|
|
@ -51,8 +51,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
// setVerticalDragEnabled(false);
|
|
|
|
// setVerticalDragEnabled(false);
|
|
|
|
initPropertyItemList(); |
|
|
|
initPropertyItemList(); |
|
|
|
initRightPane(); |
|
|
|
initContentPane(); |
|
|
|
initLeftPane(); |
|
|
|
|
|
|
|
// super(leftPane, rightPane);
|
|
|
|
// super(leftPane, rightPane);
|
|
|
|
setContainerWidth(CONTAINER_WIDTH); |
|
|
|
setContainerWidth(CONTAINER_WIDTH); |
|
|
|
} |
|
|
|
} |
|
|
@ -83,6 +82,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
propertyItemList.add(widgetLib); |
|
|
|
propertyItemList.add(widgetLib); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initContentPane() { |
|
|
|
|
|
|
|
initRightPane(); |
|
|
|
|
|
|
|
initLeftPane(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 右侧属性面板
|
|
|
|
// 右侧属性面板
|
|
|
|
private void initRightPane() { |
|
|
|
private void initRightPane() { |
|
|
|
rightPane = new JPanel(); |
|
|
|
rightPane = new JPanel(); |
|
|
@ -109,6 +113,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
replaceLeftPane(leftPane); |
|
|
|
replaceLeftPane(leftPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 弹出面板时,更新框架内容
|
|
|
|
|
|
|
|
private void removeItem(PropertyItem propertyItem) { |
|
|
|
|
|
|
|
leftPane.remove(propertyItem.getButton()); |
|
|
|
|
|
|
|
rightPane.remove(propertyItem.getPropertyPanel()); |
|
|
|
|
|
|
|
refreshContainer(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onResize() { |
|
|
|
public void onResize() { |
|
|
|
for (PropertyItem item : propertyItemList) { |
|
|
|
for (PropertyItem item : propertyItemList) { |
|
|
@ -236,12 +247,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
propertyPanel = new JPanel(); |
|
|
|
propertyPanel = new JPanel(); |
|
|
|
propertyPanel.setBackground(Color.pink); |
|
|
|
propertyPanel.setBackground(Color.pink); |
|
|
|
contentPane = generateContentPane(); |
|
|
|
contentPane = generateContentPane(); |
|
|
|
popupToolPane = new PopupToolPane(contentPane, PopupToolPane.UP_BUTTON); |
|
|
|
popupToolPane = new PopupToolPane(this, PopupToolPane.UP_BUTTON); |
|
|
|
propertyPanel.setLayout(new BorderLayout()); |
|
|
|
propertyPanel.setLayout(new BorderLayout()); |
|
|
|
propertyPanel.add(popupToolPane, BorderLayout.NORTH); |
|
|
|
propertyPanel.add(popupToolPane, BorderLayout.NORTH); |
|
|
|
propertyPanel.add(contentPane, BorderLayout.CENTER); |
|
|
|
propertyPanel.add(contentPane, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setIsPoppedOut(boolean isPoppedOut) { |
|
|
|
|
|
|
|
this.isPoppedOut = isPoppedOut; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JComponent generateContentPane() { |
|
|
|
public JComponent generateContentPane() { |
|
|
|
JComponent contentPane = new JPanel(); |
|
|
|
JComponent contentPane = new JPanel(); |
|
|
|
JButton testBtn = new JButton(name); |
|
|
|
JButton testBtn = new JButton(name); |
|
|
@ -350,18 +365,24 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
private int model = UIConstants.MODEL_NORMAL; |
|
|
|
private int model = UIConstants.MODEL_NORMAL; |
|
|
|
private String title = "单元格元素"; |
|
|
|
private String title = "单元格元素"; |
|
|
|
private JComponent contentPane; |
|
|
|
private JComponent contentPane; |
|
|
|
|
|
|
|
private PropertyItem propertyItem; |
|
|
|
private String buttonType; |
|
|
|
private String buttonType; |
|
|
|
|
|
|
|
private JDialog parentDialog; // 如果不在对话框中,值为null
|
|
|
|
|
|
|
|
private boolean isMovable = false; |
|
|
|
|
|
|
|
private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到
|
|
|
|
|
|
|
|
|
|
|
|
private static final String NO_BUTTON = "NoButton"; |
|
|
|
private static final String NO_BUTTON = "NoButton"; |
|
|
|
private static final String UP_BUTTON = "UpButton"; |
|
|
|
private static final String UP_BUTTON = "UpButton"; |
|
|
|
private static final String DOWN_BUTTON = "DownButton"; |
|
|
|
private static final String DOWN_BUTTON = "DownButton"; |
|
|
|
|
|
|
|
|
|
|
|
public PopupToolPane(JComponent contentPane) { |
|
|
|
public PopupToolPane(PropertyItem propertyItem) { |
|
|
|
this(contentPane, NO_BUTTON); |
|
|
|
this(propertyItem, NO_BUTTON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PopupToolPane(JComponent contentPane, String buttonType) { |
|
|
|
public PopupToolPane(PropertyItem propertyItem, String buttonType) { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
this.contentPane = contentPane; |
|
|
|
this.propertyItem = propertyItem; |
|
|
|
|
|
|
|
this.contentPane = propertyItem.getContentPane(); |
|
|
|
setLayout(new BorderLayout()); |
|
|
|
setLayout(new BorderLayout()); |
|
|
|
UILabel label = new UILabel(title); |
|
|
|
UILabel label = new UILabel(title); |
|
|
|
label.setForeground(new Color(69, 135, 255)); |
|
|
|
label.setForeground(new Color(69, 135, 255)); |
|
|
@ -371,7 +392,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
initToolButton(buttonType); |
|
|
|
initToolButton(buttonType); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initToolButton(String buttonType) { |
|
|
|
public void setParentDialog(JDialog parentDialog) { |
|
|
|
|
|
|
|
this.parentDialog = parentDialog; |
|
|
|
|
|
|
|
isMovable = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initToolButton(final String buttonType) { |
|
|
|
this.buttonType = buttonType; |
|
|
|
this.buttonType = buttonType; |
|
|
|
if (buttonType.equals(NO_BUTTON)) { |
|
|
|
if (buttonType.equals(NO_BUTTON)) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -400,6 +426,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseDragged(MouseEvent e) { |
|
|
|
public void mouseDragged(MouseEvent e) { |
|
|
|
|
|
|
|
if (isMovable && e.getX() < ARROW_RANGE_START) { |
|
|
|
|
|
|
|
Point currCoords = e.getLocationOnScreen(); |
|
|
|
|
|
|
|
parentDialog.setLocation(currCoords.x - mouseDownCompCoords.x, currCoords.y - mouseDownCompCoords.y); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
addMouseListener(new MouseAdapter() { |
|
|
|
addMouseListener(new MouseAdapter() { |
|
|
@ -413,14 +443,35 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
if (e.getX() >= ARROW_RANGE_START) { |
|
|
|
if (e.getX() >= ARROW_RANGE_START) { |
|
|
|
popupDialog(); |
|
|
|
onPop(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseReleased(MouseEvent e) { |
|
|
|
|
|
|
|
mouseDownCompCoords = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
|
|
|
mouseDownCompCoords = e.getPoint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void popupDialog() { |
|
|
|
// 触发弹入、弹出
|
|
|
|
new PopupDialog(contentPane); |
|
|
|
private void onPop() { |
|
|
|
|
|
|
|
if (buttonType.equals(UP_BUTTON)) { |
|
|
|
|
|
|
|
popUpDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void popUpDialog() { |
|
|
|
|
|
|
|
propertyItem.setIsPoppedOut(true); |
|
|
|
|
|
|
|
new PopupDialog(propertyItem); |
|
|
|
|
|
|
|
// initContentPane();
|
|
|
|
|
|
|
|
// refreshContainer();
|
|
|
|
|
|
|
|
removeItem(propertyItem); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -459,25 +510,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class PopupDialog extends JDialog { |
|
|
|
private class PopupDialog extends JDialog { |
|
|
|
public PopupDialog(JComponent contentPane) { |
|
|
|
private Container container; |
|
|
|
// setUndecorated(true);
|
|
|
|
public PopupDialog(PropertyItem propertyItem) { |
|
|
|
|
|
|
|
container = getContentPane(); |
|
|
|
|
|
|
|
setUndecorated(true); |
|
|
|
// JPanel pane = new JPanel();
|
|
|
|
// JPanel pane = new JPanel();
|
|
|
|
// pane.setBackground(Color.yellow);
|
|
|
|
// pane.setBackground(Color.yellow);
|
|
|
|
// pane.setPreferredSize(new Dimension(100, 100));
|
|
|
|
// pane.setPreferredSize(new Dimension(100, 100));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// getContentPane().add(pane);
|
|
|
|
// getContentPane().add(pane);
|
|
|
|
// setSize(CONTENT_WIDTH, pane.getPreferredSize().height);
|
|
|
|
// setSize(CONTENT_WIDTH, pane.getPreferredSize().height);
|
|
|
|
getContentPane().add(contentPane); |
|
|
|
PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.DOWN_BUTTON); |
|
|
|
setSize(CONTENT_WIDTH, contentPane.getPreferredSize().height); |
|
|
|
popupToolPane.setParentDialog(this); |
|
|
|
|
|
|
|
JComponent contentPane = propertyItem.getContentPane(); |
|
|
|
|
|
|
|
container.add(popupToolPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
container.add(contentPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
setSize(CONTENT_WIDTH, container.getPreferredSize().height); |
|
|
|
validate(); |
|
|
|
validate(); |
|
|
|
|
|
|
|
|
|
|
|
this.setVisible(true); |
|
|
|
this.setVisible(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void refreshContainer() { |
|
|
|
|
|
|
|
validate(); |
|
|
|
|
|
|
|
repaint(); |
|
|
|
|
|
|
|
revalidate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |