@ -102,20 +102,8 @@ public class CellStyleListEditPane extends JListControlPane {
@Override
protected JNameEdList createJNameList ( ) {
JNameEdList nameEdList = super . createJNameList ( ) ;
nameEdList . setCellEditor ( new DefaultListCellEditor ( new UITextField ( ) ) {
@Override
public Component getListCellEditorComponent ( JList list , Object value , boolean isSelected , int index ) {
ListModelElement element = ( ListModelElement ) getModel ( ) . getElementAt ( index ) ;
if ( element ! = null ) {
NameObject selectNameObject = ( NameObject ) element . wrapper ;
ThemedCellStyle cellStyle = ( ThemedCellStyle ) ( selectNameObject . getObject ( ) ) ;
if ( ! cellStyle . isRemovable ( ) ) {
return null ;
}
}
return super . getListCellEditorComponent ( list , value , isSelected , index ) ;
}
} ) ;
nameEdList . setCellEditor ( new UnEditableListCellEditor ( new UITextField ( ) ) ) ;
nameEdList . setCellRenderer ( new NoIconNameableListCellRenderer ( ) ) ;
return nameEdList ;
}
@ -294,4 +282,35 @@ public class CellStyleListEditPane extends JListControlPane {
return ( ( ThemedCellStyle ) ob ) . isUse4Default ( ) ;
}
}
private class NoIconNameableListCellRenderer extends NameableListCellRenderer {
@Override
public Component getListCellRendererComponent ( JList list , Object value , int index , boolean isSelected , boolean cellHasFocus ) {
Component component = super . getListCellRendererComponent ( list , value , index , isSelected , cellHasFocus ) ;
if ( component instanceof NameableListCellRenderer ) {
( ( NameableListCellRenderer ) component ) . setIcon ( null ) ;
( ( NameableListCellRenderer ) component ) . setBorder ( BorderFactory . createEmptyBorder ( 0 , 4 , 0 , 0 ) ) ;
}
return component ;
}
}
private class UnEditableListCellEditor extends DefaultListCellEditor {
public UnEditableListCellEditor ( UITextField textField ) {
super ( textField ) ;
}
@Override
public Component getListCellEditorComponent ( JList list , Object value , boolean isSelected , int index ) {
ListModelElement element = ( ListModelElement ) getModel ( ) . getElementAt ( index ) ;
if ( element ! = null ) {
NameObject selectNameObject = ( NameObject ) element . wrapper ;
ThemedCellStyle cellStyle = ( ThemedCellStyle ) ( selectNameObject . getObject ( ) ) ;
if ( ! cellStyle . isRemovable ( ) ) {
return null ;
}
}
return super . getListCellEditorComponent ( list , value , isSelected , index ) ;
}
}
}