Browse Source

REPORT-3163 合作开发9.0设计器=>外框架=》列表面板视觉修改

master
plough 7 years ago
parent
commit
51050c403e
  1. 2
      designer_base/src/com/fr/design/constants/UIConstants.java
  2. 13
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  3. 39
      designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
  4. 4
      designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java

2
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);

13
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();

39
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());

4
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);
}
}

Loading…
Cancel
Save