From dda9731acb746f390914fdbfaa6b3b21a52cf30f Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 13 Sep 2017 16:55:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-4554=20tab=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/constants/UIConstants.java | 5 +++++ .../com/fr/design/gui/ibutton/UIButtonUI.java | 18 ++++++++++------- .../mainframe/EastRegionContainerPane.java | 20 +++++++++++++++++++ .../fr/design/utils/gui/GUIPaintUtils.java | 19 ++++++++++++++---- 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index 6b928ebaf..39ea2e6fb 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -106,6 +106,11 @@ public interface UIConstants { public static final Color TITLED_BORDER_COLOR = new Color(0xededee); public static final Color POP_DIALOG_BORDER = new Color(218, 218, 221); public static final Color PROPERTY_DIALOG_BORDER = new Color(0xc9c9cd); + public static final Color TAB_BUTTON_HOVER = new Color(231, 230, 235); + public static final Color TAB_BUTTON_HOVER_SELECTED = new Color(239, 238, 243); + public static final Color TAB_BUTTON_PRESS = new Color(228, 227, 232); + public static final Color TAB_BUTTON_PRESS_SELECTED = new Color(236, 236, 238); + public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png"); diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java b/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java index 6c2ae3c57..ee98d0928 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java @@ -42,19 +42,23 @@ public class UIButtonUI extends BasicButtonUI { ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (b.isExtraPainted()) { - if (isPressed(b) && b.isPressedPainted()) { - GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles)); - } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); - } + doExtraPainting(b, g2d, w, h, selectedRoles); } ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintContent(g, b, text); } + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles)); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + } + } + protected boolean isRollOver(AbstractButton b) { ButtonModel model = b.getModel(); return model.isRollover() && !b.isSelected(); diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index ed2d245b6..daa1de105 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -4,10 +4,12 @@ import com.fr.base.BaseUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.Inter; @@ -638,6 +640,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { selectedItem = this; } + private boolean isTabButtonSelected() { + return button.getBackground() == selectedBtnBackground; + } + private void initButton() { button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { public Dimension getPreferredSize() { @@ -649,6 +655,20 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } }; button.set4LargeToolbarButton(); + button.setUI(new UIButtonUI() { + @Override + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + Color pressColor = isTabButtonSelected() ? UIConstants.TAB_BUTTON_PRESS_SELECTED : UIConstants.TAB_BUTTON_PRESS; + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressColor); + } else if (isRollOver(b)) { + Color hoverColor = isTabButtonSelected() ? UIConstants.TAB_BUTTON_HOVER_SELECTED : UIConstants.TAB_BUTTON_HOVER; + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + } + } + }); originBtnBackground = button.getBackground(); button.addActionListener(new ActionListener() { @Override diff --git a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java index b6f52e199..fb21725d6 100644 --- a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java +++ b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java @@ -85,13 +85,18 @@ public class GUIPaintUtils { * @param isPressedPainted 是否按压画 */ public static final void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { + fillRollOver(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, isPressedPainted, null); + } + + public static final void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted, Color hoverColor) { GradientPaint gp; - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (hoverColor != null) { + gp = new GradientPaint(1, 1, hoverColor, 1, height - 1, hoverColor); + } else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.ATTRIBUTE_HOVER, 1, height - 1, UIConstants.ATTRIBUTE_HOVER); - }else { -// gp = new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, height - 1, UIConstants.HOVER_BLUE); + } else { gp = new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); } fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); @@ -110,8 +115,14 @@ public class GUIPaintUtils { * */ public static final void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { + fillPressed(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, null); + } + + public static final void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, Color pressedColor) { Color oldColor = g2d.getColor(); - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (pressedColor != null) { + g2d.setColor(pressedColor); + } else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); } else { g2d.setColor(UIConstants.ATTRIBUTE_PRESS); From 1f1fc63d6ce27706ce6c530d15789c2818653b1b Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 13 Sep 2017 17:05:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-4554=20=E5=BC=B9=E5=87=BA=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF=E6=9C=80=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/EastRegionContainerPane.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index daa1de105..61fe8032f 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -40,7 +40,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { 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 = 356; public static final String KEY_CELL_ELEMENT = "cellElement"; public static final String KEY_CELL_ATTR = "cellAttr"; @@ -1016,9 +1015,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { 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); } From 37faa2635314b5bcf99d8362da36b83c5449e879 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 13 Sep 2017 17:53:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-4554=20=E5=B1=9E=E6=80=A7=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=BC=B9=E5=87=BA=E5=90=8E=E9=83=A8=E5=88=86=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 61fe8032f..b87b19a5f 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -522,6 +522,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } + public void reAddContentArea() { + propertyPanel.add(contentArea, BorderLayout.CENTER); + } + public boolean isVisible() { return isVisible; } @@ -579,7 +583,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { popupDialog.replaceContentPane(this); } if (popupPane != null && !isRightPaneVisible()) { - popupPane.replaceContentPane(contentPane); + popupPane.replaceContentPane(contentArea); } refreshContainer(); @@ -589,6 +593,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return contentPane; } + public Container getContentArea() { + return contentArea; + } + public void replaceHeaderPane(JComponent pane) { contentArea.remove(headerPane); int height = Math.min(pane.getPreferredSize().height, MAX_PARA_HEIGHT); @@ -613,7 +621,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { hideCurrentPopupPane(); replaceContentPane(contentPane); } else if(popupPane != null) { - popupPane.replaceContentPane(contentPane); + popupPane.replaceContentPane(contentArea); } } @@ -733,6 +741,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (isPoppedOut) { isPoppedOut = false; popupDialog.setVisible(false); + reAddContentArea(); initContentPane(); onResize(); if (isEnabled()) { @@ -745,9 +754,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private class FixedPopupPane extends JPopupMenu { - private JComponent contentPane; + private Container contentPane; + private PropertyItem propertyItem; + FixedPopupPane(PropertyItem propertyItem) { - contentPane = propertyItem.getContentPane(); + this.propertyItem = propertyItem; + contentPane = propertyItem.getContentArea(); this.setLayout(new BorderLayout()); this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH); this.add(contentPane, BorderLayout.CENTER); @@ -755,14 +767,24 @@ public class EastRegionContainerPane extends UIEastResizableContainer { setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, POPUP_DEFAULT_HEIGHT)); } + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible == true) { + replaceContentPane(propertyItem.getContentArea()); + } else { + propertyItem.reAddContentArea(); + } + } + public void menuSelectionChanged(boolean isIncluded) { } - public JComponent getContentPane() { + public Container getContentPane() { return contentPane; } - public void replaceContentPane(JComponent pane) { + public void replaceContentPane(Container pane) { this.remove(this.contentPane); this.add(this.contentPane = pane); refreshContainer(); @@ -939,7 +961,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private Point mouseDownCompCoords; private JPanel contentWrapper; - private JComponent contentPane; + private Container contentPane; private JPanel defaultPane; // 无可用配置项 private PropertyItem propertyItem; public PopupDialog(PropertyItem propertyItem) { @@ -949,7 +971,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.propertyItem = propertyItem; PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON); popupToolPane.setParentDialog(this); - contentPane = propertyItem.getContentPane(); + contentPane = propertyItem.getContentArea(); contentWrapper = new JPanel(new BorderLayout()); contentWrapper.add(popupToolPane, BorderLayout.NORTH); @@ -988,10 +1010,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceContentPane(PropertyItem propertyItem) { this.propertyItem = propertyItem; - replaceContentPane(propertyItem.getContentPane()); + replaceContentPane(propertyItem.getContentArea()); } - public void replaceContentPane(JComponent contentPane) { + public void replaceContentPane(Container contentPane) { contentWrapper.remove(this.contentPane); contentWrapper.add(this.contentPane = contentPane, BorderLayout.CENTER); refreshContainer();