|
|
@ -25,8 +25,9 @@ public class UINameableListCellRenderer extends |
|
|
|
JPanel implements ListCellRenderer { |
|
|
|
JPanel implements ListCellRenderer { |
|
|
|
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
|
|
|
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
|
|
|
private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
|
|
|
private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
|
|
|
|
|
|
|
private static final Color BORDER_COLOR = new Color(201, 198, 184); |
|
|
|
protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER; |
|
|
|
protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER; |
|
|
|
private static final int BUTTON_WIDTH = 20; |
|
|
|
private static final int BUTTON_WIDTH = 25; |
|
|
|
private UILabel editButton; // "编辑按钮",实际上是一个 UILabel,由列表项(UIListControlPane)统一处理点击事件
|
|
|
|
private UILabel editButton; // "编辑按钮",实际上是一个 UILabel,由列表项(UIListControlPane)统一处理点击事件
|
|
|
|
private UILabel label; |
|
|
|
private UILabel label; |
|
|
|
private UIListControlPane listControlPane; |
|
|
|
private UIListControlPane listControlPane; |
|
|
@ -48,6 +49,8 @@ public class UINameableListCellRenderer extends |
|
|
|
}; |
|
|
|
}; |
|
|
|
// editButton.set4LargeToolbarButton();
|
|
|
|
// editButton.set4LargeToolbarButton();
|
|
|
|
editButton.setIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); |
|
|
|
editButton.setIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); |
|
|
|
|
|
|
|
editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR)); |
|
|
|
|
|
|
|
editButton.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
// editButton.addActionListener(new ActionListener() {
|
|
|
|
// editButton.addActionListener(new ActionListener() {
|
|
|
|
// @Override
|
|
|
|
// @Override
|
|
|
|
// public void actionPerformed(ActionEvent e) {
|
|
|
|
// public void actionPerformed(ActionEvent e) {
|
|
|
@ -55,30 +58,28 @@ public class UINameableListCellRenderer extends |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
label = new UILabel(); |
|
|
|
label = new UILabel(); |
|
|
|
|
|
|
|
label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
|
|
|
// label.setEditable(false);
|
|
|
|
// label.setEditable(false);
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.add(editButton, BorderLayout.WEST); |
|
|
|
this.add(editButton, BorderLayout.WEST); |
|
|
|
this.add(label, BorderLayout.CENTER); |
|
|
|
this.add(label, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void popupEditPane() { |
|
|
|
|
|
|
|
GUICoreUtils.showPopupMenu(listControlPane.popupEditPane, editButton, |
|
|
|
|
|
|
|
- listControlPane.popupEditPane.getPreferredSize().width, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Border getNoFocusBorder() { |
|
|
|
private Border getNoFocusBorder() { |
|
|
|
Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder"); |
|
|
|
// return BorderFactory.createLineBorder(new Color(201, 198, 184));
|
|
|
|
if (System.getSecurityManager() != null) { |
|
|
|
return BorderFactory.createMatteBorder(0, 0, 1, 0, BORDER_COLOR); |
|
|
|
if (border != null) return border; |
|
|
|
// Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
|
|
|
|
return SAFE_NO_FOCUS_BORDER; |
|
|
|
// if (System.getSecurityManager() != null) {
|
|
|
|
} else { |
|
|
|
// if (border != null) return border;
|
|
|
|
if (border != null && |
|
|
|
// return SAFE_NO_FOCUS_BORDER;
|
|
|
|
(noFocusBorder == null || |
|
|
|
// } else {
|
|
|
|
noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) { |
|
|
|
// if (border != null &&
|
|
|
|
return border; |
|
|
|
// (noFocusBorder == null ||
|
|
|
|
} |
|
|
|
// noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
|
|
|
|
return noFocusBorder; |
|
|
|
// return border;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
// return noFocusBorder;
|
|
|
|
|
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setText(String t) { |
|
|
|
private void setText(String t) { |
|
|
|