|
|
@ -4,7 +4,6 @@ import com.fr.base.theme.TemplateTheme; |
|
|
|
import com.fr.base.theme.settings.ThemedCellStyle; |
|
|
|
import com.fr.base.theme.settings.ThemedCellStyle; |
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
import com.fr.design.cell.CellRectangleStylePreviewPane; |
|
|
|
import com.fr.design.cell.CellRectangleStylePreviewPane; |
|
|
|
import com.fr.design.cell.CellStylePreviewPane; |
|
|
|
|
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.gui.ibutton.UIRadioButton; |
|
|
|
import com.fr.design.gui.ibutton.UIRadioButton; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
@ -36,14 +35,10 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl |
|
|
|
private final JList<ThemedCellStyle> styleList; |
|
|
|
private final JList<ThemedCellStyle> styleList; |
|
|
|
private ChangeListener changeListener; |
|
|
|
private ChangeListener changeListener; |
|
|
|
|
|
|
|
|
|
|
|
public ThemedCellStyleListPane() { |
|
|
|
public ThemedCellStyleListPane(boolean supportInnerBorder) { |
|
|
|
this(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ThemedCellStyleListPane(boolean supportCellRange) { |
|
|
|
|
|
|
|
defaultListModel = new DefaultListModel<>(); |
|
|
|
defaultListModel = new DefaultListModel<>(); |
|
|
|
styleList = new JList<>(defaultListModel); |
|
|
|
styleList = new JList<>(defaultListModel); |
|
|
|
styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer()); |
|
|
|
styleList.setCellRenderer(new RadioButtonListCellRangeRenderer(supportInnerBorder)); |
|
|
|
styleList.setOpaque(false); |
|
|
|
styleList.setOpaque(false); |
|
|
|
styleList.setBackground(null); |
|
|
|
styleList.setBackground(null); |
|
|
|
styleList.addListSelectionListener(new ListSelectionListener() { |
|
|
|
styleList.addListSelectionListener(new ListSelectionListener() { |
|
|
@ -115,44 +110,19 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl |
|
|
|
styleList.setModel(defaultListModel); |
|
|
|
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 static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable { |
|
|
|
|
|
|
|
|
|
|
|
private final UIRadioButton button; |
|
|
|
private final UIRadioButton button; |
|
|
|
private final CellRectangleStylePreviewPane previewArea; |
|
|
|
private final CellRectangleStylePreviewPane previewArea; |
|
|
|
|
|
|
|
|
|
|
|
public RadioButtonListCellRangeRenderer() { |
|
|
|
public RadioButtonListCellRangeRenderer(boolean supportInnerBorder) { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
setLayout(new BorderLayout(5, 0)); |
|
|
|
setLayout(new BorderLayout(5, 0)); |
|
|
|
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
|
|
|
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
|
|
|
setPreferredSize(new Dimension(getPreferredSize().width, 80)); |
|
|
|
setPreferredSize(new Dimension(getPreferredSize().width, 80)); |
|
|
|
button = new UIRadioButton(); |
|
|
|
button = new UIRadioButton(); |
|
|
|
button.setBorder(BorderFactory.createEmptyBorder()); |
|
|
|
button.setBorder(BorderFactory.createEmptyBorder()); |
|
|
|
previewArea = new CellRectangleStylePreviewPane(); |
|
|
|
previewArea = new CellRectangleStylePreviewPane(supportInnerBorder); |
|
|
|
add(button, BorderLayout.WEST); |
|
|
|
add(button, BorderLayout.WEST); |
|
|
|
add(previewArea, BorderLayout.CENTER); |
|
|
|
add(previewArea, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|