|
|
|
@ -4,7 +4,6 @@ import com.fr.base.theme.TemplateTheme;
|
|
|
|
|
import com.fr.base.theme.settings.ThemedCellStyle; |
|
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
|
import com.fr.design.cell.CellRectangleStylePreviewPane; |
|
|
|
|
import com.fr.design.cell.CellStylePreviewPane; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
|
import com.fr.design.gui.ibutton.UIRadioButton; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
@ -36,14 +35,10 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
|
|
|
|
|
private final JList<ThemedCellStyle> styleList; |
|
|
|
|
private ChangeListener changeListener; |
|
|
|
|
|
|
|
|
|
public ThemedCellStyleListPane() { |
|
|
|
|
this(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ThemedCellStyleListPane(boolean supportCellRange) { |
|
|
|
|
public ThemedCellStyleListPane(boolean supportInnerBorder) { |
|
|
|
|
defaultListModel = new DefaultListModel<>(); |
|
|
|
|
styleList = new JList<>(defaultListModel); |
|
|
|
|
styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer()); |
|
|
|
|
styleList.setCellRenderer(new RadioButtonListCellRangeRenderer(supportInnerBorder)); |
|
|
|
|
styleList.setOpaque(false); |
|
|
|
|
styleList.setBackground(null); |
|
|
|
|
styleList.addListSelectionListener(new ListSelectionListener() { |
|
|
|
@ -115,43 +110,18 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
|
|
|
|
|
styleList.setModel(defaultListModel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable { |
|
|
|
|
|
|
|
|
|
private final UIRadioButton button; |
|
|
|
|
private final CellStylePreviewPane previewArea; |
|
|
|
|
|
|
|
|
|
public RadioButtonListCellRenderer() { |
|
|
|
|
super(); |
|
|
|
|
setLayout(new BorderLayout(20, 0)); |
|
|
|
|
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
|
|
|
setPreferredSize(new Dimension(getPreferredSize().width, 40)); |
|
|
|
|
button = new UIRadioButton(); |
|
|
|
|
previewArea = new CellStylePreviewPane(); |
|
|
|
|
add(button, BorderLayout.WEST); |
|
|
|
|
add(previewArea, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Component getListCellRendererComponent(JList<? extends ThemedCellStyle> list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
|
button.setSelected(isSelected); |
|
|
|
|
previewArea.setPaintText(value.getName()); |
|
|
|
|
previewArea.setStyle(value.getStyle()); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable { |
|
|
|
|
|
|
|
|
|
private final UIRadioButton button; |
|
|
|
|
private final CellRectangleStylePreviewPane previewArea; |
|
|
|
|
|
|
|
|
|
public RadioButtonListCellRangeRenderer() { |
|
|
|
|
public RadioButtonListCellRangeRenderer(boolean supportInnerBorder) { |
|
|
|
|
super(); |
|
|
|
|
setLayout(new BorderLayout(5, 0)); |
|
|
|
|
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
|
|
|
|
button = new UIRadioButton(); |
|
|
|
|
button.setBorder(BorderFactory.createEmptyBorder()); |
|
|
|
|
previewArea = new CellRectangleStylePreviewPane(); |
|
|
|
|
previewArea = new CellRectangleStylePreviewPane(supportInnerBorder); |
|
|
|
|
add(button, BorderLayout.WEST); |
|
|
|
|
add(previewArea, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|