Browse Source

REPORT-3163 合作开发9.0设计器=>新列表面板=》修复自定义列表项控制台报错的bug

master
plough 7 years ago
parent
commit
5810601058
  1. 6
      designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
  2. 5
      designer_base/src/com/fr/design/gui/ilist/UIList.java

6
designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java

@ -143,18 +143,12 @@ public class UINameableListCellRenderer extends
Nameable wrappee = ((ListModelElement) value).wrapper; Nameable wrappee = ((ListModelElement) value).wrapper;
this.setText(((ListModelElement) value).wrapper.getName()); this.setText(((ListModelElement) value).wrapper.getName());
boolean iconSet = false;
for (NameableCreator creator : listControlPane.creators()) { for (NameableCreator creator : listControlPane.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) { if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
// this.setIcon(creator.menuIcon());
this.setToolTipText(creator.createTooltip()); this.setToolTipText(creator.createTooltip());
iconSet = true;
break; break;
} }
} }
// if (!iconSet) {
// this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
// }
} }
return this; return this;

5
designer_base/src/com/fr/design/gui/ilist/UIList.java

@ -1,6 +1,7 @@
package com.fr.design.gui.ilist; package com.fr.design.gui.ilist;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.design.gui.controlpane.UINameableListCellRenderer;
import com.fr.design.gui.itooltip.UIToolTip; import com.fr.design.gui.itooltip.UIToolTip;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -43,6 +44,10 @@ public class UIList extends JList {
Object value = getModel().getElementAt(index); Object value = getModel().getElementAt(index);
ListCellRenderer renderer = getCellRenderer(); ListCellRenderer renderer = getCellRenderer();
Component rendererComp = renderer.getListCellRendererComponent(this, value, index, true, false); Component rendererComp = renderer.getListCellRendererComponent(this, value, index, true, false);
// UINameableListCellRenderer 继承自JPanel,无法强转为JLabel,直接返回即可
if (rendererComp instanceof UINameableListCellRenderer) {
return null;
}
if (rendererComp.getPreferredSize().width > getVisibleRect().width) { if (rendererComp.getPreferredSize().width > getVisibleRect().width) {
String tips = (rendererComp instanceof JComponent) ? ((JComponent) rendererComp).getToolTipText() : null; String tips = (rendererComp instanceof JComponent) ? ((JComponent) rendererComp).getToolTipText() : null;
if (tips == null) { if (tips == null) {

Loading…
Cancel
Save