Browse Source

REPORT-3163 合作开发9.0设计器=>属性面板收起状态时,点击竖向tab,弹出属性面板

master
plough 7 years ago
parent
commit
0569a1ff26
  1. 7
      designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  2. 80
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

7
designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -228,6 +228,12 @@ public class UIEastResizableContainer extends JPanel {
revalidate(); revalidate();
} }
/**
* 伸缩右子面板时触发此方法
*/
public void onResize() {
}
private class TopToolPane extends JPanel { private class TopToolPane extends JPanel {
private int model = UIConstants.MODEL_NORMAL; private int model = UIConstants.MODEL_NORMAL;
@ -268,6 +274,7 @@ public class UIEastResizableContainer extends JPanel {
setPreferredWidth(containerWidth); setPreferredWidth(containerWidth);
containerWidth = leftPaneWidth; containerWidth = leftPaneWidth;
} }
onResize();
refreshContainer(); refreshContainer();
if (BaseUtils.isAuthorityEditing()) { if (BaseUtils.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize(); DesignerContext.getDesignerFrame().doResize();

80
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.icontainer.UIResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.AbstractPopBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -46,7 +47,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
initRightPane(); initRightPane();
initLeftPane(); initLeftPane();
// super(leftPane, rightPane); // super(leftPane, rightPane);
setContainerWidth(260); setContainerWidth(CONTAINER_WIDTH);
} }
private void initPropertyItemList() { private void initPropertyItemList() {
@ -101,6 +102,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
replaceLeftPane(leftPane); replaceLeftPane(leftPane);
} }
@Override
public void onResize() {
for (PropertyItem item : propertyItemList) {
item.onResize();
}
}
public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) { public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) {
super(leftPane, rightPane); super(leftPane, rightPane);
// setVerticalDragEnabled(false); // setVerticalDragEnabled(false);
@ -192,9 +200,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private String name; private String name;
private JPanel propertyPanel; private JPanel propertyPanel;
private JComponent contentPane; private JComponent contentPane;
private PropertyFixedPopupPane popupPane; // 左侧固定弹出框
private int x, y; // 弹出框的坐标 private int x, y; // 弹出框的坐标
private int height; // 弹出框的高度 private int height; // 弹出框的高度
private boolean isPoppedOut; // 是否弹出 private boolean isPoppedOut; // 是否弹出
private Dimension fixedSize;
public PropertyItem(String name, String btnUrl) { public PropertyItem(String name, String btnUrl) {
this.name = name; this.name = name;
@ -210,10 +220,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private void initPropertyPanel() { private void initPropertyPanel() {
propertyPanel = new JPanel(); propertyPanel = new JPanel();
propertyPanel.setBackground(Color.pink); propertyPanel.setBackground(Color.pink);
// propertyPanel.setPreferredSize(getPreferredSize()); contentPane = generateContentPane();
// JPanel titlePanel = new JPanel(); propertyPanel.setLayout(new BorderLayout());
// titlePanel.setPreferredSize(new Dimension(propertyPanel.getPreferredSize().width, 20)); propertyPanel.add(contentPane, BorderLayout.CENTER);
// titlePanel }
public JComponent generateContentPane() {
JComponent contentPane = new JPanel();
JButton testBtn = new JButton(name); JButton testBtn = new JButton(name);
testBtn.addActionListener(new ActionListener() { testBtn.addActionListener(new ActionListener() {
@Override @Override
@ -221,14 +234,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
setEnabled(!button.isEnabled()); setEnabled(!button.isEnabled());
} }
}); });
contentPane = new JPanel();
contentPane.add(testBtn); contentPane.add(testBtn);
propertyPanel.setLayout(new BorderLayout()); return contentPane;
propertyPanel.add(contentPane, BorderLayout.CENTER);
} }
public void replaceContentPane(JComponent pane) { public void replaceContentPane(JComponent pane) {
// remove(pane);
propertyPanel.remove(this.contentPane); propertyPanel.remove(this.contentPane);
propertyPanel.add(this.contentPane = pane); propertyPanel.add(this.contentPane = pane);
refreshContainer(); refreshContainer();
@ -238,6 +248,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
return contentPane; return contentPane;
} }
public void onResize() {
if (isRightPaneVisible()) {
replaceContentPane(contentPane);
} else if(popupPane != null) {
popupPane.replaceContentPane(contentPane);
}
}
private void refreshContainer() { private void refreshContainer() {
propertyPanel.validate(); propertyPanel.validate();
propertyPanel.repaint(); propertyPanel.repaint();
@ -250,22 +268,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH); return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH);
} }
}; };
// button = new UIButton("btnd\nssdg");
// button.set4LargeToolbarButton();
// button.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0));
// button.setMargin(null);
// button.setOpaque(false);
button.set4LargeToolbarButton(); button.set4LargeToolbarButton();
// button.setSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH));
// button.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH));
// button.setContentAreaFilled(false);
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (isRightPaneVisible()) { if (isRightPaneVisible()) {
propertyCard.show(rightPane, name); propertyCard.show(rightPane, name);
} else { } else {
popOut(); popupFixedPane();
} }
} }
}); });
@ -284,9 +294,37 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
// 弹出对话框 // 弹出对话框
public void popOut() { public void popupFixedPane() {
JDialog dialog = new JDialog(); if (popupPane == null) {
dialog.setVisible(true); popupPane = new PropertyFixedPopupPane(contentPane);
}
GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0);
}
}
private class PropertyFixedPopupPane extends JPopupMenu {
private JComponent contentPane;
PropertyFixedPopupPane(JComponent contentPane) {
this.contentPane = contentPane;
this.add(contentPane);
this.setPreferredSize(new Dimension(CONTAINER_WIDTH - BUTTON_WIDTH, getPreferredSize().height));
}
public JComponent getContentPane() {
return contentPane;
}
public void replaceContentPane(JComponent pane) {
// remove(pane);
this.remove(this.contentPane);
this.add(this.contentPane = pane);
refreshContainer();
}
private void refreshContainer() {
validate();
repaint();
revalidate();
} }
} }
} }
Loading…
Cancel
Save