diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index c63dcdea7..77ae66350 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -88,6 +88,7 @@ public interface UIConstants { public static final Color DEFAULT_BG_RULER = new Color(0xf7f7f7); public static final Color RULER_LINE_COLOR = new Color(0xababab); public static final Color RULER_SCALE_COLOR = new Color(0x4e504f); + public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd); @@ -104,6 +105,8 @@ public interface UIConstants { public static final BufferedImage DRAG_LEFT_PRESS = BaseUtils.readImage("com/fr/design/images/control/leftpre.png"); public static final BufferedImage DRAG_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png"); public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png"); + public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png"); + public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png"); public static final int MODEL_NORMAL = 0; public static final int MODEL_PRESS = 1; public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png"); diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java index 19390a784..8e9fb6ffa 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -63,11 +63,12 @@ public class UIEastResizableContainer extends JPanel { } public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) { - setBackground(UIConstants.NORMAL_BACKGROUND); + setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); this.leftPane = leftPane; this.rightPane = rightPane; this.topToolPane = new TopToolPane(); + topToolPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); setLayout(containerLayout); add(topToolPane); diff --git a/designer_base/src/com/fr/design/images/buttonicon/popdownarrow.png b/designer_base/src/com/fr/design/images/buttonicon/popdownarrow.png new file mode 100644 index 000000000..d89d95139 Binary files /dev/null and b/designer_base/src/com/fr/design/images/buttonicon/popdownarrow.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/popuparrow.png b/designer_base/src/com/fr/design/images/buttonicon/popuparrow.png new file mode 100644 index 000000000..76f831bf0 Binary files /dev/null and b/designer_base/src/com/fr/design/images/buttonicon/popuparrow.png differ diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index ddad370b2..4dcf2332f 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -28,12 +28,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private JPanel leftPane; private JPanel rightPane; private FixedPopupPane currentPopupPane; - private static final int CONTAINER_WIDTH = 290; - private static final int TAB_WIDTH = 40; + private static final int CONTAINER_WIDTH = 288; + private static final int TAB_WIDTH = 38; private static final int TAB_BUTTON_WIDTH = 32; + private static final int TAB_BUTTON_HEIGHT = 28; private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; private static final int POPUP_TOOLPANE_HEIGHT = 25; private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30; + // 弹出对话框高度 + private static final int POPUP_MIN_HEIGHT = 145; + private static final int POPUP_MAX_HEIGHT = 480; + private static final int POPUP_DEFAULT_HEIGHT = 360; private static final String KEY_CELL_ELEMENT = "cellElement"; private static final String KEY_CELL_ATTR = "cellAttr"; private static final String KEY_FLOAT_ELEMENT = "floatElement"; @@ -138,6 +143,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private JPanel getDefaultPane() { JPanel defaultPane = new JPanel(); UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available")); + label.setHorizontalAlignment(SwingConstants.CENTER); defaultPane.setLayout(new BorderLayout()); defaultPane.add(label, BorderLayout.CENTER); return defaultPane; @@ -177,8 +183,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { leftPane.add(item.getButton()); } -// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS)); - leftPane.setBackground(new Color(226, 226, 226)); + leftPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); replaceLeftPane(leftPane); } @@ -431,7 +436,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final String ICON_SUFFIX_SELECTED = "_selected.png"; private String btnIconName; private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 - private final Color selectedBtnBackground = new Color(240, 240, 240); + private final Color selectedBtnBackground = new Color(0xF5F5F7); private Color originBtnBackground; public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { @@ -577,7 +582,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initButton() { button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { public Dimension getPreferredSize() { - return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_WIDTH); + return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); } @Override public void paintComponent(Graphics g) { @@ -666,36 +671,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private class FixedPopupPane extends JPopupMenu { private JComponent contentPane; -// private PopupToolPane popupToolPane; - private int fixedHeight; FixedPopupPane(PropertyItem propertyItem) { contentPane = propertyItem.getContentPane(); this.setLayout(new BorderLayout()); -// popupToolPane = ; this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH); this.add(contentPane, BorderLayout.CENTER); this.setOpaque(false); - fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height; - updateSize(); + setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, POPUP_DEFAULT_HEIGHT)); } public void menuSelectionChanged(boolean isIncluded) { } - private void updateSize() { - int newHeight = fixedHeight + contentPane.getPreferredSize().height; - this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight)); - } - public JComponent getContentPane() { return contentPane; } public void replaceContentPane(JComponent pane) { -// remove(pane); this.remove(this.contentPane); this.add(this.contentPane = pane); - updateSize(); refreshContainer(); } @@ -708,9 +702,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 弹出属性面板的工具条 private class PopupToolPane extends JPanel { - private int model = UIConstants.MODEL_NORMAL; private String title; - private JComponent contentPane; private PropertyItem propertyItem; private String buttonType; private JDialog parentDialog; // 如果不在对话框中,值为null @@ -733,7 +725,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (mouseDownCompCoords == null) { setBackground(originColor); } - model = UIConstants.MODEL_NORMAL; repaint(); } @Override @@ -762,13 +753,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void mouseMoved(MouseEvent e) { if (e.getX() >= ARROW_RANGE_START) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - model = UIConstants.MODEL_PRESS; } else if (isMovable) { setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); setBackground(Color.pink); } else { setCursor(Cursor.getDefaultCursor()); - model = UIConstants.MODEL_NORMAL; } repaint(); } @@ -808,13 +797,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { super(); this.propertyItem = propertyItem; this.title = propertyItem.getTitle(); - this.contentPane = propertyItem.getContentPane(); - originColor = getBackground(); + originColor = Color.white; + setBackground(originColor); setLayout(new BorderLayout()); UILabel label = new UILabel(title); - label.setForeground(new Color(69, 135, 255)); add(label, BorderLayout.WEST); - setBorder(new EmptyBorder(5, 10, 0, 0)); + setBorder(new EmptyBorder(5, 10, 5, 0)); initToolButton(buttonType); } @@ -857,27 +845,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { Image button; g.setColor(new Color(69, 135, 255)); g.setFont(FRFont.getInstance().applySize(14)); -// g.drawString(title, 5, 20); -// g.drawImage(UIConstants.DRAG_BAR, 0, 0, CONTENT_WIDTH, POPUP_TOOLPANE_HEIGHT, null); - if (buttonType.equals(NO_BUTTON)) { return; } if (buttonType.equals(DOWN_BUTTON)) { - if (model == UIConstants.MODEL_NORMAL) { - button = UIConstants.DRAG_LEFT_NORMAL; - } else { - button = UIConstants.DRAG_LEFT_PRESS; - } + button = UIConstants.POP_BUTTON_DOWN; } else { - if (model == UIConstants.MODEL_NORMAL) { - button = UIConstants.DRAG_RIGHT_NORMAL; - } else { - button = UIConstants.DRAG_RIGHT_PRESS; - } + button = UIConstants.POP_BUTTON_UP; } -// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); - g.drawImage(button, ARROW_RANGE_START + 12, 7, 5, 5, null); + g.drawImage(button, ARROW_RANGE_START + 8, 4, 16, 16, null); } } @@ -887,7 +863,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private Cursor originCursor; private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); private Point mouseDownCompCoords; - private int minHeight; // 对话框最小高度 + private JComponent contentPane; private PropertyItem propertyItem; public PopupDialog(PropertyItem propertyItem) { @@ -900,8 +876,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { contentPane = propertyItem.getContentPane(); container.add(popupToolPane, BorderLayout.NORTH); container.add(contentPane, BorderLayout.CENTER); - minHeight = container.getPreferredSize().height; - setSize(CONTENT_WIDTH, minHeight); + setSize(CONTENT_WIDTH, POPUP_DEFAULT_HEIGHT); // validate(); adjustLocation(); @@ -941,8 +916,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { Point currCoords = e.getLocationOnScreen(); bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height; // 校正位置 - if (bounds.height < minHeight) { - bounds.height = minHeight; + if (bounds.height < POPUP_MIN_HEIGHT) { + bounds.height = POPUP_MIN_HEIGHT; + } + if (bounds.height > POPUP_MAX_HEIGHT) { + bounds.height = POPUP_MAX_HEIGHT; } mouseDownCompCoords.y = currCoords.y; setBounds(bounds);