Browse Source

REPORT-3163 合作开发9.0设计器=>使用UIButton作为竖向tab的按钮

master
plough 7 years ago
parent
commit
d6d632aedc
  1. 12
      designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  2. 31
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

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

@ -33,7 +33,7 @@ public class UIEastResizableContainer extends JPanel {
private static final int ARROW_MARGIN = 15; private static final int ARROW_MARGIN = 15;
private static final int ARROW_RANGE = 35; private static final int ARROW_RANGE = 35;
private boolean isRightPaneVisible = true; // private boolean isRightPaneVisible = true;
public UIEastResizableContainer() { public UIEastResizableContainer() {
this(new JPanel(), new JPanel()); this(new JPanel(), new JPanel());
@ -49,11 +49,15 @@ public class UIEastResizableContainer extends JPanel {
this.preferredWidth = width; this.preferredWidth = width;
} }
public boolean isRightPaneVisible() {
public void setRightPaneVisible(boolean isVisible){ return containerWidth > leftPaneWidth;
this.isRightPaneVisible = isVisible;
} }
// public void setRightPaneVisible(boolean isVisible){
// this.isRightPaneVisible = isVisible;
// }
private void setPreferredWidth(int width) { private void setPreferredWidth(int width) {
this.preferredWidth = width; this.preferredWidth = width;
} }

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

@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ibutton.UIButton; 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.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -90,6 +91,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// 左侧按钮面板 // 左侧按钮面板
private void initLeftPane() { private void initLeftPane() {
leftPane = new JPanel(); leftPane = new JPanel();
leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0));
for (PropertyItem item : propertyItemList) { for (PropertyItem item : propertyItemList) {
leftPane.add(item.getButton()); leftPane.add(item.getButton());
} }
@ -186,7 +188,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
class PropertyItem { class PropertyItem {
// private UIButton button; // private UIButton button;
private JButton button; private UIButton button;
private String name; private String name;
private JPanel propertyPanel; private JPanel propertyPanel;
private JComponent contentPane; private JComponent contentPane;
@ -243,20 +245,33 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
private void initButton(String btnUrl) { private void initButton(String btnUrl) {
button = new JButton(BaseUtils.readIcon(btnUrl)); button = new UIButton(BaseUtils.readIcon(btnUrl)) {
public Dimension getPreferredSize() {
return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH);
}
};
// button = new UIButton("btnd\nssdg"); // button = new UIButton("btnd\nssdg");
// button.set4LargeToolbarButton(); // button.set4LargeToolbarButton();
button.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH)); // button.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0));
button.setContentAreaFilled(false); // button.setMargin(null);
// button.setOpaque(false);
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()) {
propertyCard.show(rightPane, name); propertyCard.show(rightPane, name);
} else {
popOut();
}
} }
}); });
} }
public JButton getButton() { public UIButton getButton() {
return button; return button;
} }
@ -267,5 +282,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public JPanel getPropertyPanel() { public JPanel getPropertyPanel() {
return propertyPanel; return propertyPanel;
} }
// 弹出对话框
public void popOut() {
JDialog dialog = new JDialog();
dialog.setVisible(true);
}
} }
} }
Loading…
Cancel
Save