forked from fanruan/design
Browse Source
Merge in DESIGN/design from ~STARRYI/design:REPORT-62689/feature/x to feature/x * commit '0113bf2e89ab9aa2095337b201a4dfa9ed509271': REPORT-62689 主题编辑的边框配置完善feature/x
starryi
3 years ago
15 changed files with 430 additions and 276 deletions
@ -0,0 +1,79 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.report.cell.CellElementBorderSourceFlag; |
||||
import com.fr.base.CellBorderStyle; |
||||
import com.fr.base.Style; |
||||
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.Dimension; |
||||
import java.awt.GridLayout; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/9/3 |
||||
*/ |
||||
public class CellRectangleStylePreviewPane extends JPanel { |
||||
private static final int ROW_COUNT = 2; |
||||
private static final int COLUMN_COUNT = 2; |
||||
|
||||
private final TemplateCellElement[][] cellElementGrid = new TemplateCellElement[ROW_COUNT][COLUMN_COUNT]; |
||||
private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT]; |
||||
|
||||
public CellRectangleStylePreviewPane() { |
||||
setLayout(new GridLayout(2, 2)); |
||||
|
||||
for (int r = 0; r < ROW_COUNT; r++) { |
||||
for (int c = 0; c < COLUMN_COUNT; c++) { |
||||
CellStylePreviewPane pane = new CellStylePreviewPane(); |
||||
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); |
||||
int flags = CellElementBorderSourceFlag.ALL_BORDER_SOURCE_OUTER; |
||||
if (r != 0) { |
||||
flags |= CellElementBorderSourceFlag.TOP_BORDER_SOURCE_INNER; |
||||
} |
||||
if (r != ROW_COUNT - 1) { |
||||
flags |= CellElementBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER; |
||||
} |
||||
if (c != 0) { |
||||
flags |= CellElementBorderSourceFlag.LEFT_BORDER_SOURCE_INNER; |
||||
} |
||||
if (c != COLUMN_COUNT - 1) { |
||||
flags |= CellElementBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER; |
||||
} |
||||
cellElement.setBorderSourceFlags(flags); |
||||
|
||||
pane.setStyle(cellElement.getStyle()); |
||||
add(pane); |
||||
|
||||
cellElementGrid[r][c] = cellElement; |
||||
cellStylePreviewPaneGrid[r][c] = pane; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void setPlainText(String text) { |
||||
cellStylePreviewPaneGrid[0][1].setPaintText(text); |
||||
cellStylePreviewPaneGrid[1][1].setPaintText(text); |
||||
repaint(); |
||||
} |
||||
|
||||
public void setStyle(Style style, CellBorderStyle borderStyle) { |
||||
for (int i = 0; i < ROW_COUNT; i++) { |
||||
for (int j = 0; j < COLUMN_COUNT; j++) { |
||||
CellStylePreviewPane pane = cellStylePreviewPaneGrid[i][j]; |
||||
TemplateCellElement cellElement = cellElementGrid[i][j]; |
||||
cellElement.setStyle(style, borderStyle); |
||||
|
||||
pane.setStyle(cellElement.getStyle()); |
||||
} |
||||
} |
||||
repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getMinimumSize() { |
||||
return getPreferredSize(); |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.mainframe.theme; |
||||
|
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.server.theme.SupportThemedCellInnerBorderFeature; |
||||
import com.fr.workspace.server.theme.ThemedCellBorderFeature; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/11/26 |
||||
*/ |
||||
public class ThemedFeatureController { |
||||
public static boolean isCellStyleSupportInnerBorder() { |
||||
ThemedCellBorderFeature controller = WorkContext.getCurrent().get(ThemedCellBorderFeature.class); |
||||
return controller instanceof SupportThemedCellInnerBorderFeature; |
||||
} |
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.fr.design.mainframe.cell.settingpane.style; |
||||
|
||||
import com.fr.base.CellBorderStyle; |
||||
import com.fr.base.NameStyle; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.theme.TemplateTheme; |
||||
import com.fr.base.theme.settings.ThemedCellStyle; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.mainframe.theme.ThemedCellStyleListPane; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/11/23 |
||||
*/ |
||||
public class NameStyleListPane extends ThemedCellStyleListPane { |
||||
|
||||
public NameStyleListPane() { |
||||
} |
||||
|
||||
public NameStyleListPane(boolean supportCellRange) { |
||||
super(supportCellRange); |
||||
} |
||||
|
||||
public void populateNameStyle(NameStyle style) { |
||||
String name = style.getName(); |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (template != null) { |
||||
TemplateTheme theme = template.getTemplateTheme(); |
||||
ThemedCellStyle themedCellStyle = theme.getCellStyleList().find(name); |
||||
populateBean(themedCellStyle); |
||||
} |
||||
} |
||||
|
||||
public NameStyle updateNameStyle() { |
||||
ThemedCellStyle themedCellStyle = updateBean(); |
||||
if (themedCellStyle != null) { |
||||
String name = themedCellStyle.getName(); |
||||
Style style = themedCellStyle.getStyle(); |
||||
return NameStyle.getPassiveInstance(name, style); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
|
||||
public CellBorderStyle updateBorderStyle() { |
||||
ThemedCellStyle nameStyle = updateBean(); |
||||
if (nameStyle != null) { |
||||
return nameStyle.getCellBorderStyle(); |
||||
} |
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue