From 51050c403e905793cfd9302d0f2dfba9cda2fefb Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 3 Aug 2017 17:28:47 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=A4=96=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=3D=E3=80=8B=E5=88=97=E8=A1=A8=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E8=A7=86=E8=A7=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/constants/UIConstants.java | 2 + .../design/gui/controlpane/UIControlPane.java | 13 +++++-- .../UINameableListCellRenderer.java | 39 +++++-------------- .../icontainer/UIEastResizableContainer.java | 4 +- 4 files changed, 23 insertions(+), 35 deletions(-) diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index 77ae66350..4b4a1b5f8 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -135,6 +135,8 @@ public interface UIConstants { public static final Icon EDIT_ICON = BaseUtils.readIcon("com/fr/design/images/m_file/edit.png"); public static final Icon SEARCH_ICON = BaseUtils.readIcon("/com/fr/design/images/data/search.png"); public static final Icon CLEAR_ICON = BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png"); + public static final Icon LIST_EDIT_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png"); + public static final Icon LIST_EDIT_WHITE_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png"); public static final Color PRESSED_DARK_GRAY = new Color(127, 127, 127); public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45); public static final Color BARNOMAL = new Color(153, 153, 153); diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index af47f1de8..0a04ea446 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -2,6 +2,7 @@ package com.fr.design.gui.controlpane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -112,7 +113,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH // mainSplitPane.setOneTouchExpandable(true); this.add(getLeftPane(), BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(0, 10, 12, 10)); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 12, 10)); // mainSplitPane.setDividerLocation(getLeftPreferredSize()); this.checkButtonEnabled(); } @@ -137,14 +138,20 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH toolbarDef.addShortCut(sj.getShortCut()); } toolBar = ToolBarDef.createJToolBar(); -// toolBar.setLayout(new FlowLayout(FlowLayout.LEFT)); + toolBar.setUI(new UIToolBarUI(){ + @Override + public void paint(Graphics g, JComponent c) { + Graphics2D g2 = (Graphics2D) g; + g2.setColor(Color.white); + g2.fillRect(0, 0, c.getWidth(), c.getHeight()); + } + }); toolbarDef.updateToolBar(toolBar); // 封装一层,加边框 JPanel toolBarPane = new JPanel(new BorderLayout()); toolBarPane.add(toolBar, BorderLayout.CENTER); toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(201, 198, 184))); leftContentPane.add(toolBarPane, BorderLayout.NORTH); -// leftContentPane.setBorder(BorderFactory.createLineBorder(new Color(201, 198, 184))); // 顶部标签及add按钮 topToolBar = new UIToolbar(); diff --git a/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java index 8da13e681..086cd5a77 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.controlpane; import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.ListModelElement; @@ -31,6 +32,7 @@ public class UINameableListCellRenderer extends private UILabel editButton; // "编辑按钮",实际上是一个 UILabel,由列表项(UIListControlPane)统一处理点击事件 private UILabel label; private UIListControlPane listControlPane; + private Color initialLabelForeground; public UINameableListCellRenderer(UIListControlPane listControlPane) { super(); @@ -47,39 +49,19 @@ public class UINameableListCellRenderer extends return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH); } }; -// editButton.set4LargeToolbarButton(); - editButton.setIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); + editButton.setIcon(UIConstants.LIST_EDIT_ICON); editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR)); editButton.setHorizontalAlignment(SwingConstants.CENTER); -// editButton.addActionListener(new ActionListener() { -// @Override -// public void actionPerformed(ActionEvent e) { -// popupEditDialog(); -// } -// }); label = new UILabel(); label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); -// label.setEditable(false); + initialLabelForeground = label.getForeground(); this.setLayout(new BorderLayout()); this.add(editButton, BorderLayout.WEST); this.add(label, BorderLayout.CENTER); } private Border getNoFocusBorder() { -// return BorderFactory.createLineBorder(new Color(201, 198, 184)); return BorderFactory.createMatteBorder(0, 0, 1, 0, BORDER_COLOR); - // Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder"); -// if (System.getSecurityManager() != null) { -// if (border != null) return border; -// return SAFE_NO_FOCUS_BORDER; -// } else { -// if (border != null && -// (noFocusBorder == null || -// noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) { -// return border; -// } -// return noFocusBorder; -// } } private void setText(String t) { @@ -108,20 +90,17 @@ public class UINameableListCellRenderer extends if (isSelected) { setBackground(bg == null ? list.getSelectionBackground() : bg); setForeground(fg == null ? list.getSelectionForeground() : fg); + label.setForeground(Color.white); + editButton.setIcon(UIConstants.LIST_EDIT_WHITE_ICON); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); + label.setForeground(initialLabelForeground); + editButton.setIcon(UIConstants.LIST_EDIT_ICON); } -// if (value instanceof Icon) { -// setIcon((Icon)value); -// setText(""); -// } -// else { -// setIcon(null); - setText((value == null) ? "" : value.toString()); -// } + setText((value == null) ? "" : value.toString()); setEnabled(list.isEnabled()); setFont(list.getFont()); 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 8e9fb6ffa..8f82b1b09 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -20,7 +20,7 @@ public class UIEastResizableContainer extends JPanel { private static final long serialVersionUID = 1854340560790476907L; private int containerWidth = 240; private int preferredWidth = 240; - private int topToolPaneHeight = 20; + private int topToolPaneHeight = 25; private int leftPaneWidth = 40; private JComponent leftPane; @@ -308,7 +308,7 @@ public class UIEastResizableContainer extends JPanel { } } // g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); - g.drawImage(button, 18, 7, 5, 5, null); + g.drawImage(button, 18, 9, 5, 5, null); } }