You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
5.0 KiB
113 lines
5.0 KiB
7 months ago
|
package com.fr.widgettheme.theme.panel;
|
||
|
|
||
|
import com.fr.base.CellBorderSourceFlag;
|
||
|
import com.fr.base.theme.TemplateTheme;
|
||
|
import com.fr.base.theme.settings.ThemedCellStyleList;
|
||
|
import com.fr.design.i18n.Toolkit;
|
||
|
import com.fr.design.layout.FRGUIPaneFactory;
|
||
|
import com.fr.design.mainframe.theme.preview.UINoOpaquePanel;
|
||
|
import com.fr.design.mainframe.theme.preview.ecpreview.AbstractECPreviewPane;
|
||
|
import com.fr.design.mainframe.theme.preview.ecpreview.cell.AbstractPreviewCell;
|
||
|
import com.fr.design.mainframe.theme.preview.ecpreview.cell.PreviewCell;
|
||
|
|
||
|
import javax.swing.BorderFactory;
|
||
|
import javax.swing.JPanel;
|
||
|
import java.awt.BorderLayout;
|
||
|
import java.awt.Dimension;
|
||
|
import java.awt.GridLayout;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* 主题界面frm里的那个表格,做了简单修改,削减了几行重复内容,腾出控件参数面板的空间
|
||
|
*
|
||
|
* @author John.Ying
|
||
|
* @since 11.0
|
||
|
* Created on 2021/3/18
|
||
|
*/
|
||
|
public class WidgetThemeECPreviewPane extends AbstractECPreviewPane {
|
||
|
private final List<AbstractPreviewCell> headerCellList = new ArrayList<>();
|
||
|
private final List<AbstractPreviewCell> contentCellList = new ArrayList<>();
|
||
|
private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
|
||
|
private final List<AbstractPreviewCell> assistCellList = new ArrayList<>();
|
||
|
private static final int COL_COUNT = 5;
|
||
|
private static final int CONTENT_ROW_COUNT = 1;
|
||
|
|
||
|
public WidgetThemeECPreviewPane() {
|
||
|
this.setPreferredSize(new Dimension(517, 158 - 36));
|
||
|
this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1));
|
||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout());
|
||
|
JPanel titlePane = new UINoOpaquePanel(new GridLayout());
|
||
|
JPanel extCenterPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
|
||
|
this.add(extCenterPane, BorderLayout.CENTER);
|
||
|
extCenterPane.add(titlePane, BorderLayout.NORTH);
|
||
|
for (int c = 0; c < COL_COUNT; c++) {
|
||
|
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
|
||
|
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
|
||
|
if (c > 0) {
|
||
|
flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
|
||
|
}
|
||
|
if (c < COL_COUNT - 1) {
|
||
|
flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
|
||
|
}
|
||
|
cell.setBorderSourceFlag(flag);
|
||
|
cell.setPreferredSize(new Dimension(103, 36));
|
||
|
titlePane.add(cell);
|
||
|
headerCellList.add(cell);
|
||
|
}
|
||
|
JPanel contentPane = new UINoOpaquePanel(new GridLayout(1, 5, 0, 0));
|
||
|
extCenterPane.add(contentPane, BorderLayout.CENTER);
|
||
|
for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) {
|
||
|
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
|
||
|
int c = i % COL_COUNT;
|
||
|
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
|
||
|
if (c > 0) {
|
||
|
flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
|
||
|
}
|
||
|
if (c < COL_COUNT - 1) {
|
||
|
flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
|
||
|
}
|
||
|
cell.setBorderSourceFlag(flag);
|
||
|
cell.setPreferredSize(new Dimension(103, 30));
|
||
|
contentPane.add(cell);
|
||
|
contentCellList.add(cell);
|
||
|
}
|
||
|
|
||
|
JPanel endPane = new UINoOpaquePanel(new GridLayout());
|
||
|
extCenterPane.add(endPane, BorderLayout.SOUTH);
|
||
|
for (int c = 0; c < COL_COUNT; c++) {
|
||
|
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
|
||
|
int flag = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
|
||
|
if (c > 0) {
|
||
|
flag |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
|
||
|
}
|
||
|
if (c < COL_COUNT - 1) {
|
||
|
flag |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
|
||
|
}
|
||
|
cell.setBorderSourceFlag(flag);
|
||
|
cell.setPreferredSize(new Dimension(103, 30));
|
||
|
endPane.add(cell);
|
||
|
highLightCellList.add(cell);
|
||
|
}
|
||
|
|
||
|
JPanel extSouthPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
|
||
|
PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text"));
|
||
|
assistCell.setBorderSourceFlag(CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER);
|
||
|
assistCell.setPreferredSize(new Dimension(123, 30));
|
||
|
assistCellList.add(assistCell);
|
||
|
extSouthPane.add(assistCell);
|
||
|
this.add(extSouthPane, BorderLayout.SOUTH);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void refresh(TemplateTheme theme) {
|
||
|
ThemedCellStyleList cellStyleConfig = theme.getCellStyleList();
|
||
|
refresh(headerCellList, cellStyleConfig.getUse4Header());
|
||
|
refresh(contentCellList, cellStyleConfig.getUse4MainText());
|
||
|
refresh(highLightCellList, cellStyleConfig.getUse4HighlightText());
|
||
|
refresh(assistCellList, cellStyleConfig.getUse4SupportInfo());
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|