Browse Source
Merge in DESIGN/design from ~STARRYI/design:KERNEL-9742 to feature/x * commit '8bf4dd2f10d78deada3d4d96f5eea5ac0b0f8c90': KERNEL-9742 删除2020年迭代后未发布的旧主题功能代码feature/x
starryi
3 years ago
52 changed files with 8 additions and 5851 deletions
@ -1,40 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
//import com.fr.predefined.PredefinedPatternStyleManager;
|
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-31 |
|
||||||
*/ |
|
||||||
public enum PatternStyle { |
|
||||||
DARK_STYLE(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Dark_Pattern")) { |
|
||||||
@Override |
|
||||||
public PredefinedStyle getPredefinedStyle() { |
|
||||||
// return PredefinedPatternStyleManager.INSTANCE.getDarkMode();
|
|
||||||
return new PredefinedStyle(); |
|
||||||
} |
|
||||||
}, |
|
||||||
LIGHT_STYLE(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Light_Pattern")) { |
|
||||||
@Override |
|
||||||
public PredefinedStyle getPredefinedStyle() { |
|
||||||
// return PredefinedPatternStyleManager.INSTANCE.getLightMode();
|
|
||||||
return new PredefinedStyle(); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
private String name; |
|
||||||
|
|
||||||
|
|
||||||
PatternStyle(String name) { |
|
||||||
this.name = name; |
|
||||||
} |
|
||||||
|
|
||||||
public String getName() { |
|
||||||
return this.name; |
|
||||||
} |
|
||||||
|
|
||||||
public abstract PredefinedStyle getPredefinedStyle(); |
|
||||||
|
|
||||||
} |
|
@ -1,143 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.base.GraphHelper; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.design.mainframe.predefined.ui.dialog.PredefinedStyleEditDialog; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.general.IOUtils; |
|
||||||
import com.fr.stable.Constants; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.Icon; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.SwingUtilities; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.Rectangle; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
import java.awt.event.MouseEvent; |
|
||||||
import java.awt.event.MouseListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-25 |
|
||||||
*/ |
|
||||||
public class PredefinedStyleBlock extends JPanel { |
|
||||||
private PredefinedStyle previewObject; |
|
||||||
private PredefinedStyleSelectPane parentPane; |
|
||||||
private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/marker_selected.png"); |
|
||||||
private static final Color BORDER_COLOR = new Color(141, 194, 249); |
|
||||||
|
|
||||||
private boolean mouseOver = false; |
|
||||||
|
|
||||||
private MouseListener mouseListener = new MouseListener() { |
|
||||||
@Override |
|
||||||
public void mouseClicked(MouseEvent e) { |
|
||||||
setSelect(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mousePressed(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mouseReleased(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mouseEntered(MouseEvent e) { |
|
||||||
mouseOver = true; |
|
||||||
PredefinedStyleBlock.this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mouseExited(MouseEvent e) { |
|
||||||
mouseOver = false; |
|
||||||
PredefinedStyleBlock.this.repaint(); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
public PredefinedStyleBlock(PredefinedStyle previewObject, PredefinedStyleSelectPane selectPane, boolean supportEdit) { |
|
||||||
this.previewObject = previewObject; |
|
||||||
this.parentPane = selectPane; |
|
||||||
initPane(supportEdit); |
|
||||||
this.addMouseListener(mouseListener); |
|
||||||
} |
|
||||||
|
|
||||||
private void setSelect() { |
|
||||||
this.parentPane.setSelectedPreviewPane(this); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void paint(Graphics g) { |
|
||||||
super.paint(g); |
|
||||||
boolean isSelected = ComparatorUtils.equals(this, this.parentPane.getSelectedPreviewPane()); |
|
||||||
if (ComparatorUtils.equals(this.parentPane.getCurrentApplicateStyle(), this.previewObject.getStyleName())) { |
|
||||||
markedMode.paintIcon(this, g, 176, 0); |
|
||||||
} |
|
||||||
if (isSelected || this.mouseOver) { |
|
||||||
g.setColor(BORDER_COLOR); |
|
||||||
Rectangle rectangle = new Rectangle(1, 1, this.getWidth() - 2, this.getHeight() - 2); |
|
||||||
GraphHelper.draw(g, rectangle, Constants.LINE_MEDIUM); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private void initPane(boolean supportEdit) { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
PredefinedStylePreviewPane content = new PredefinedStylePreviewPane(0.387, 0.384); |
|
||||||
content.setParent(this); |
|
||||||
content.setPreferredSize(new Dimension(200, 180)); |
|
||||||
UILabel label = new UILabel(previewObject.getStyleName()); |
|
||||||
label.setToolTipText(previewObject.getStyleName()); |
|
||||||
label.setPreferredSize(new Dimension(167, 25)); |
|
||||||
|
|
||||||
|
|
||||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
panel.setBorder(BorderFactory.createEmptyBorder(0,9,2,5)); |
|
||||||
panel.add(label, BorderLayout.WEST); |
|
||||||
if (supportEdit) { |
|
||||||
addEditButton(panel); |
|
||||||
} |
|
||||||
|
|
||||||
this.add(content, BorderLayout.CENTER); |
|
||||||
this.add(panel, BorderLayout.SOUTH); |
|
||||||
this.setPreferredSize(new Dimension(200, 210)); |
|
||||||
panel.setBackground(Color.WHITE); |
|
||||||
this.setBackground(Color.WHITE); |
|
||||||
content.refresh(this.previewObject); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private void addEditButton(JPanel panel) { |
|
||||||
UIButton editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/icon/icon_edit.png")); |
|
||||||
editButton.setPreferredSize(new Dimension(24, 24)); |
|
||||||
editButton.setBorderPainted(false); |
|
||||||
editButton.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
PredefinedStyleEditPane editPane = PredefinedStyleEditPane.createEditPane(parentPane); |
|
||||||
PredefinedStyleEditDialog editDialog = new PredefinedStyleEditDialog( |
|
||||||
SwingUtilities.getWindowAncestor(PredefinedStyleBlock.this), editPane, previewObject.isBuiltIn()); |
|
||||||
editPane.populate(PredefinedStyleBlock.this.previewObject); |
|
||||||
editDialog.setVisible(true); |
|
||||||
} |
|
||||||
}); |
|
||||||
panel.add(editButton, BorderLayout.EAST); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public PredefinedStyle update() { |
|
||||||
return this.previewObject; |
|
||||||
} |
|
||||||
} |
|
@ -1,374 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui; |
|
||||||
|
|
||||||
import com.fr.base.ChartColorMatching; |
|
||||||
import com.fr.base.ChartPreStyleConfig; |
|
||||||
import com.fr.base.Style; |
|
||||||
import com.fr.base.background.ColorBackground; |
|
||||||
import com.fr.config.predefined.ColorFillStyle; |
|
||||||
import com.fr.config.predefined.PredefinedCellStyle; |
|
||||||
import com.fr.config.predefined.PredefinedCellStyleConfig; |
|
||||||
import com.fr.config.predefined.PredefinedColorStyle; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.config.predefined.PredefinedStyleConfig; |
|
||||||
import com.fr.config.ServerPreferenceConfig; |
|
||||||
import com.fr.design.dialog.FineJOptionPane; |
|
||||||
import com.fr.design.file.HistoryTemplateListCache; |
|
||||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
|
||||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
||||||
import com.fr.design.gui.frpane.UITabbedPane; |
|
||||||
import com.fr.design.gui.icontainer.UIScrollPane; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.gui.itextfield.UITextField; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.ChartStyleSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.ColorFillStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.PredefinedBackgroundSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.CellStyleListControlPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane; |
|
||||||
import com.fr.design.ui.util.UIUtil; |
|
||||||
import com.fr.design.utils.DesignUtils; |
|
||||||
import com.fr.general.FRFont; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
import com.fr.transaction.Configurations; |
|
||||||
import com.fr.transaction.WorkerFacade; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.SwingUtilities; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Iterator; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-26 |
|
||||||
*/ |
|
||||||
public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane { |
|
||||||
private static final Color TIP_COLOR = Color.decode("#8F8F92"); |
|
||||||
|
|
||||||
private PredefinedStylePreviewPane previewPane; |
|
||||||
private UITextField styleNameField; |
|
||||||
private PredefinedBackgroundSettingPane backgroundSettingPane; |
|
||||||
private CellStyleListControlPane cellStyleSettingPane; |
|
||||||
private ComponentStyleSettingPane componentStyleSettingPane; |
|
||||||
private ChartStyleSettingPane chartStyleSettingPane; |
|
||||||
private PredefinedStyleSelectPane selectPane; |
|
||||||
private ColorFillStylePane colorFillStylePane; |
|
||||||
private boolean isPopulating = false; |
|
||||||
private UITabbedPane uiTabbedPane; |
|
||||||
|
|
||||||
private boolean isLightMode = true; |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createContentPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
jPanel.add(createLeftPane(), BorderLayout.WEST); |
|
||||||
jPanel.add(createRightPane(), BorderLayout.CENTER); |
|
||||||
|
|
||||||
this.addAttributeChangeListener(new AttributeChangeListener() { |
|
||||||
@Override |
|
||||||
public void attributeChange() { |
|
||||||
if (!isPopulating) { |
|
||||||
valueChangeAction(); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
public void valueChangeAction() { |
|
||||||
boolean displayFormBackground = backgroundSettingPane.currentFormBackground() || uiTabbedPane.getSelectedIndex() == 3; |
|
||||||
previewPane.refresh(this.update(), displayFormBackground); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Edit"); |
|
||||||
} |
|
||||||
|
|
||||||
private PredefinedStyleEditPane(PredefinedStyleSelectPane selectPane, boolean newEditPane) { |
|
||||||
this.selectPane = selectPane; |
|
||||||
this.styleNameField.setEnabled(newEditPane); |
|
||||||
} |
|
||||||
|
|
||||||
public static PredefinedStyleEditPane createEditPane(PredefinedStyleSelectPane selectPane) { |
|
||||||
return new PredefinedStyleEditPane(selectPane, false); |
|
||||||
} |
|
||||||
|
|
||||||
public static PredefinedStyleEditPane createNewEditPane(PredefinedStyleSelectPane selectPane) { |
|
||||||
return new PredefinedStyleEditPane(selectPane, true); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private JPanel createLeftPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Overall_Preview")); |
|
||||||
previewPane = new PredefinedStylePreviewPane(); |
|
||||||
previewPane.setPreferredSize(new Dimension(517, 500)); |
|
||||||
|
|
||||||
titlePane.add(previewPane); |
|
||||||
jPanel.add(titlePane, BorderLayout.CENTER); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
private JPanel createRightPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel styleNamePane = createStyleNamePane(); |
|
||||||
jPanel.add(styleNamePane, BorderLayout.NORTH); |
|
||||||
|
|
||||||
JPanel basicSettingPane = createBasicSettingPane(); |
|
||||||
jPanel.add(basicSettingPane, BorderLayout.CENTER); |
|
||||||
|
|
||||||
JPanel customDetailPane = createCustomDetailPane(); |
|
||||||
jPanel.add(customDetailPane, BorderLayout.SOUTH); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
private JPanel createStyleNamePane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(5, 26, 8); |
|
||||||
jPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Name"))); |
|
||||||
this.styleNameField = new UITextField(); |
|
||||||
this.styleNameField.setPreferredSize(new Dimension(160, 20)); |
|
||||||
jPanel.add(this.styleNameField); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
private JPanel createBasicSettingPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Basic_Setting")); |
|
||||||
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
colorFillStylePane = new ColorFillStylePane(); |
|
||||||
contentPane.add(colorFillStylePane); |
|
||||||
titlePane.add(contentPane); |
|
||||||
jPanel.add(titlePane, BorderLayout.CENTER); |
|
||||||
titlePane.setSize(new Dimension(348, 157)); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
private JPanel createCustomDetailPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Custom_Detail")); |
|
||||||
titlePane.setLayout(FRGUIPaneFactory.createLeftZeroLayout()); |
|
||||||
jPanel.add(titlePane, BorderLayout.CENTER); |
|
||||||
uiTabbedPane = new UITabbedPane(); |
|
||||||
uiTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Template_Background"), createTemplateBackgroundSettingPane()); |
|
||||||
uiTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane()); |
|
||||||
uiTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane()); |
|
||||||
uiTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Component_Style"), createComponentStyleSettingPane()); |
|
||||||
uiTabbedPane.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
valueChangeAction(); |
|
||||||
} |
|
||||||
}); |
|
||||||
titlePane.add(uiTabbedPane); |
|
||||||
uiTabbedPane.setPreferredSize(new Dimension(323, 298)); |
|
||||||
titlePane.setPreferredSize(new Dimension(333, 320)); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private JPanel createTemplateBackgroundSettingPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); |
|
||||||
this.backgroundSettingPane = new PredefinedBackgroundSettingPane(); |
|
||||||
jPanel.setPreferredSize(new Dimension(309, 248)); |
|
||||||
UIScrollPane scrollPane = new UIScrollPane(this.backgroundSettingPane); |
|
||||||
scrollPane.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
jPanel.add(new UIScrollPane(this.backgroundSettingPane)); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
private JPanel createCellStyleSettingPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); |
|
||||||
this.cellStyleSettingPane = new CellStyleListControlPane(); |
|
||||||
this.cellStyleSettingPane.registerAttrChangeListener(new AttributeChangeListener() { |
|
||||||
@Override |
|
||||||
public void attributeChange() { |
|
||||||
valueChangeAction(); |
|
||||||
} |
|
||||||
}); |
|
||||||
jPanel.add(this.cellStyleSettingPane); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private JPanel createChartStyleSettingPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); |
|
||||||
this.chartStyleSettingPane = new ChartStyleSettingPane(); |
|
||||||
jPanel.add(this.chartStyleSettingPane); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private JPanel createComponentStyleSettingPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
jPanel.setLayout(new BorderLayout(0, 5)); |
|
||||||
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); |
|
||||||
this.componentStyleSettingPane = new ComponentStyleSettingPane(); |
|
||||||
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_ComponentStyle_Setting_Tip")); |
|
||||||
label.setForeground(TIP_COLOR); |
|
||||||
jPanel.add(label, BorderLayout.NORTH); |
|
||||||
jPanel.add(this.componentStyleSettingPane, BorderLayout.CENTER); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void populate(PredefinedStyle previewObject) { |
|
||||||
isPopulating = true; |
|
||||||
isLightMode = previewObject.isLightMode(); |
|
||||||
styleNameField.setText(previewObject.getStyleName()); |
|
||||||
this.backgroundSettingPane.populateBean(previewObject.getPredefinedBackground()); |
|
||||||
this.cellStyleSettingPane.populateBean(previewObject.getCellStyleConfig()); |
|
||||||
this.componentStyleSettingPane.populateBean(previewObject.getComponentStyle()); |
|
||||||
this.colorFillStylePane.populateBean(previewObject.getPredefinedColorStyle()); |
|
||||||
this.chartStyleSettingPane.populateBean(previewObject.getPredefinedChartStyle()); |
|
||||||
previewPane.refresh(previewObject); |
|
||||||
isPopulating = false; |
|
||||||
} |
|
||||||
|
|
||||||
public PredefinedStyle update() { |
|
||||||
PredefinedStyle predefinedStyle = new PredefinedStyle(); |
|
||||||
predefinedStyle.setLightMode(isLightMode); |
|
||||||
predefinedStyle.setStyleName(this.styleNameField.getText()); |
|
||||||
PredefinedCellStyleConfig cellStyleConfig = this.cellStyleSettingPane.updateBean(); |
|
||||||
predefinedStyle.setCellStyleConfig(cellStyleConfig); |
|
||||||
|
|
||||||
predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean()); |
|
||||||
predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean()); |
|
||||||
|
|
||||||
PredefinedColorStyle colorStyle = this.colorFillStylePane.update(); |
|
||||||
updateCellStyleByColorStyle(colorStyle, cellStyleConfig); |
|
||||||
predefinedStyle.setPredefinedColorStyle(colorStyle); |
|
||||||
predefinedStyle.setPredefinedChartStyle(this.chartStyleSettingPane.updateBean()); |
|
||||||
return predefinedStyle; |
|
||||||
} |
|
||||||
|
|
||||||
private void updateCellStyleByColorStyle(PredefinedColorStyle colorStyle, PredefinedCellStyleConfig cellStyleConfig) { |
|
||||||
PredefinedCellStyle headerStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); |
|
||||||
PredefinedCellStyle highlightStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); |
|
||||||
ColorFillStyle colorFillStyle = colorStyle.getColorFillStyle(); |
|
||||||
List<Color> colorList = new ArrayList<>(); |
|
||||||
if (colorFillStyle == null || colorFillStyle.getColorList().size() == 0){ |
|
||||||
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); |
|
||||||
String defaultName = config.getCurrentStyle(); |
|
||||||
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName); |
|
||||||
if (defaultStyle != null) { |
|
||||||
colorList = defaultStyle.getColorList(); |
|
||||||
} |
|
||||||
} else { |
|
||||||
colorList = colorFillStyle.getColorList(); |
|
||||||
} |
|
||||||
if (colorList.size() < 2) { |
|
||||||
return; |
|
||||||
} |
|
||||||
if (headerStyle != null) { |
|
||||||
Style style = headerStyle.getStyle(); |
|
||||||
Color color = colorList.get(0); |
|
||||||
headerStyle.setStyle(style.deriveBackground(ColorBackground.getInstance(color))); |
|
||||||
} |
|
||||||
if (highlightStyle != null) { |
|
||||||
Style style = highlightStyle.getStyle(); |
|
||||||
Color color = colorList.get(1); |
|
||||||
FRFont font = style.getFRFont(); |
|
||||||
font.setForeground(color); |
|
||||||
highlightStyle.setStyle(style.deriveFRFont(font)); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public boolean saveStyle() { |
|
||||||
PredefinedStyle previewObject; |
|
||||||
try { |
|
||||||
previewObject = update(); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
return false; |
|
||||||
} |
|
||||||
if (this.styleNameField.isEnabled() && !validateRepeat(previewObject.getStyleName())) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
if (!saveStyle(previewObject)) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
HistoryTemplateListCache.getInstance().repaintCurrentEditingTemplate(); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
private boolean saveStyle(PredefinedStyle previewObject) { |
|
||||||
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); |
|
||||||
if (StringUtils.isEmpty(previewObject.getStyleName())) { |
|
||||||
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(PredefinedStyleEditPane.this), |
|
||||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Name_Cannot_Empty")); |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
config.add(previewObject); |
|
||||||
PredefinedStyleConfig sortedConfig = resortConfigStyles(previewObject, config); |
|
||||||
// Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(sortedConfig);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
selectPane.refreshPane(); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
public void saveAsNewStyle(String styleName) { |
|
||||||
PredefinedStyle previewObject; |
|
||||||
try { |
|
||||||
previewObject = update(); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
return; |
|
||||||
} |
|
||||||
previewObject.setStyleName(styleName); |
|
||||||
if (validateRepeat(styleName)) { |
|
||||||
saveStyle(previewObject); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private boolean validateRepeat(String styleName) { |
|
||||||
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); |
|
||||||
if (config.getStyle(styleName) != null) { |
|
||||||
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(PredefinedStyleEditPane.this), |
|
||||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Name_Repeat")); |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
private PredefinedStyleConfig resortConfigStyles(PredefinedStyle priorityStyle, PredefinedStyleConfig config){ |
|
||||||
PredefinedStyleConfig sortedConfig = new PredefinedStyleConfig(); |
|
||||||
PredefinedStyle defaultStyle = config.getDefaultPredefinedStyle(); |
|
||||||
if (defaultStyle != null) { |
|
||||||
sortedConfig.add(defaultStyle); |
|
||||||
config.removeStyle(defaultStyle.getStyleName()); |
|
||||||
sortedConfig.setDefaultPredefinedStyle(defaultStyle.getStyleName()); |
|
||||||
} |
|
||||||
if (priorityStyle != null && !priorityStyle.isDefaultStyle()) { |
|
||||||
sortedConfig.add(priorityStyle); |
|
||||||
config.removeStyle(priorityStyle.getStyleName()); |
|
||||||
} |
|
||||||
Iterator<PredefinedStyle> iterator = config.getPredefinedStyleIterator(); |
|
||||||
while (iterator.hasNext()) { |
|
||||||
PredefinedStyle entry = iterator.next(); |
|
||||||
sortedConfig.add(entry); |
|
||||||
} |
|
||||||
sortedConfig.setCompatibleStyleName(config.getCompatibleStyleName()); |
|
||||||
return sortedConfig; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,102 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui; |
|
||||||
|
|
||||||
import com.fr.config.ServerPreferenceConfig; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.event.ChangeListener; |
|
||||||
import com.fr.design.gui.icontainer.UIScrollPane; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.util.Iterator; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-26 |
|
||||||
*/ |
|
||||||
public class PredefinedStyleSelectPane extends BasicPane { |
|
||||||
private PredefinedStyleBlock selectedBlock; |
|
||||||
private boolean editable; |
|
||||||
private JPanel contentPane; |
|
||||||
private String currentApplicateStyle; |
|
||||||
private ChangeListener changeListener; |
|
||||||
|
|
||||||
|
|
||||||
public PredefinedStyleSelectPane(String currentApplicateStyle, boolean editable) { |
|
||||||
this.editable = editable; |
|
||||||
this.currentApplicateStyle = currentApplicateStyle; |
|
||||||
initPane(); |
|
||||||
} |
|
||||||
|
|
||||||
public void registerChangeListener(ChangeListener changeListener) { |
|
||||||
this.changeListener = changeListener; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private void initPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(5, 8); |
|
||||||
createContentPane(); |
|
||||||
UIScrollPane scrollPane = new UIScrollPane(contentPane); |
|
||||||
scrollPane.setPreferredSize(new Dimension(630, 480)); |
|
||||||
scrollPane.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
this.add(scrollPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void createContentPane() { |
|
||||||
contentPane.removeAll(); |
|
||||||
Iterator<PredefinedStyle> iterator = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getPredefinedStyleIterator(); |
|
||||||
int rowCount = (ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getPredefinedSize() +2)/ 3; |
|
||||||
contentPane.setPreferredSize(new Dimension(618, 220 * rowCount)); |
|
||||||
while (iterator.hasNext()) { |
|
||||||
PredefinedStyle tmpStyle = iterator.next(); |
|
||||||
|
|
||||||
if (tmpStyle != null) { |
|
||||||
PredefinedStyleBlock tmpPanel = |
|
||||||
new PredefinedStyleBlock(tmpStyle, this, this.editable); |
|
||||||
contentPane.add(tmpPanel); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public String getCurrentApplicateStyle() { |
|
||||||
return currentApplicateStyle; |
|
||||||
} |
|
||||||
|
|
||||||
public void refreshPane() { |
|
||||||
createContentPane(); |
|
||||||
this.validate(); |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
public void setSelectedPreviewPane(PredefinedStyleBlock selectedPreviewPane) { |
|
||||||
this.selectedBlock = selectedPreviewPane; |
|
||||||
if (changeListener != null) { |
|
||||||
changeListener.fireChanged(null); |
|
||||||
} |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
public PredefinedStyleBlock getSelectedPreviewPane() { |
|
||||||
return selectedBlock; |
|
||||||
} |
|
||||||
|
|
||||||
public PredefinedStyle update() { |
|
||||||
if (this.selectedBlock == null){ |
|
||||||
return null; |
|
||||||
} |
|
||||||
return this.selectedBlock.update(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,159 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedNameStyleProvider; |
|
||||||
import com.fr.design.file.HistoryTemplateListCache; |
|
||||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
|
||||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
||||||
import com.fr.design.gui.ibutton.UIRadioButton; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.JTemplate; |
|
||||||
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; |
|
||||||
import javax.swing.ButtonGroup; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.CardLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public abstract class PredefinedStyleSettingPane<T> extends AbstractAttrNoScrollPane { |
|
||||||
protected StyleSettingPreviewPane previewPane; |
|
||||||
protected UIRadioButton predefinedRadioBtn; |
|
||||||
private UIRadioButton customRadioBtn; |
|
||||||
private JPanel customDetailPane; |
|
||||||
private JPanel predefinedSettingPane; |
|
||||||
private CardLayout tabbedPane; |
|
||||||
private JPanel center; |
|
||||||
private boolean isPopulating = false; |
|
||||||
|
|
||||||
|
|
||||||
public void setPopulating(boolean populating) { |
|
||||||
isPopulating = populating; |
|
||||||
} |
|
||||||
|
|
||||||
protected void initContentPane() { |
|
||||||
leftContentPane = createContentPane(); |
|
||||||
this.add(leftContentPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createContentPane() { |
|
||||||
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
previewPane = createPreviewPane(); |
|
||||||
JPanel previewTitlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); |
|
||||||
if (previewPane != null) { |
|
||||||
previewTitlePane.setPreferredSize(new Dimension(407, 527)); |
|
||||||
previewTitlePane.add(previewPane); |
|
||||||
contentPane.add(previewTitlePane, BorderLayout.WEST); |
|
||||||
} |
|
||||||
|
|
||||||
customDetailPane = createCustomDetailPane(); |
|
||||||
predefinedSettingPane = createPredefinedSettingPane(); |
|
||||||
|
|
||||||
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(10, 20, 10); |
|
||||||
jPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style"))); |
|
||||||
predefinedRadioBtn = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined")); |
|
||||||
customRadioBtn = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")); |
|
||||||
|
|
||||||
tabbedPane = new CardLayout(); |
|
||||||
center = new JPanel(tabbedPane); |
|
||||||
center.add(predefinedSettingPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined")); |
|
||||||
center.add(customDetailPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")); |
|
||||||
predefinedRadioBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
populateCustomPane(); |
|
||||||
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined")); |
|
||||||
} |
|
||||||
}); |
|
||||||
customRadioBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")); |
|
||||||
} |
|
||||||
}); |
|
||||||
jPanel.add(predefinedRadioBtn); |
|
||||||
jPanel.add(customRadioBtn); |
|
||||||
|
|
||||||
ButtonGroup layoutBG = new ButtonGroup(); |
|
||||||
layoutBG.add(predefinedRadioBtn); |
|
||||||
layoutBG.add(customRadioBtn); |
|
||||||
centerPane.add(jPanel, BorderLayout.NORTH); |
|
||||||
centerPane.add(center, BorderLayout.CENTER); |
|
||||||
contentPane.add(centerPane, BorderLayout.CENTER); |
|
||||||
this.addAttributeChangeListener(new AttributeChangeListener() { |
|
||||||
@Override |
|
||||||
public void attributeChange() { |
|
||||||
if (isPopulating) { |
|
||||||
return; |
|
||||||
} |
|
||||||
if (previewPane != null) { |
|
||||||
previewPane.refresh(); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
return contentPane; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
protected abstract StyleSettingPreviewPane createPreviewPane(); |
|
||||||
|
|
||||||
protected abstract JPanel createCustomDetailPane(); |
|
||||||
|
|
||||||
protected JPanel createPredefinedSettingPane() { |
|
||||||
return new JPanel(); |
|
||||||
} |
|
||||||
|
|
||||||
protected void populate(PredefinedNameStyleProvider nameStyle) { |
|
||||||
this.predefinedRadioBtn.setSelected(nameStyle.usePredefinedStyle()); |
|
||||||
this.customRadioBtn.setSelected(!nameStyle.usePredefinedStyle()); |
|
||||||
if (nameStyle.usePredefinedStyle()) { |
|
||||||
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined")); |
|
||||||
} else { |
|
||||||
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
protected String getPredefinedStyleName() { |
|
||||||
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
||||||
return template.getTemplatePredefinedStyle(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 用于在切换到预定义样式后重置自定义样式的设置 |
|
||||||
*/ |
|
||||||
protected abstract void populateCustomPane(); |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 展示数据 |
|
||||||
* |
|
||||||
* @param ob 待展示的对象 |
|
||||||
*/ |
|
||||||
public abstract void populateBean(T ob); |
|
||||||
|
|
||||||
/** |
|
||||||
* 保存数据 |
|
||||||
* |
|
||||||
* @return 待保存的对象 |
|
||||||
*/ |
|
||||||
public abstract T updateBean(); |
|
||||||
|
|
||||||
/** |
|
||||||
* 保存数据 |
|
||||||
* |
|
||||||
* @param ob 待保存的对象 |
|
||||||
*/ |
|
||||||
public void updateBean(T ob) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,51 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.JTemplate; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.FlowLayout; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-28 |
|
||||||
*/ |
|
||||||
public class ReportPredefinedStylePane extends BasicPane { |
|
||||||
private PredefinedStyleSelectPane selectPane; |
|
||||||
private JTemplate currentTemplate; |
|
||||||
|
|
||||||
public ReportPredefinedStylePane(JTemplate jTemplate) { |
|
||||||
this.currentTemplate = jTemplate; |
|
||||||
initPane(); |
|
||||||
} |
|
||||||
|
|
||||||
private void initPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Select")); |
|
||||||
jPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
|
||||||
JPanel subPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
this.selectPane = new PredefinedStyleSelectPane(currentTemplate.getTemplatePredefinedStyle(), false); |
|
||||||
subPanel.add(this.selectPane, BorderLayout.CENTER); |
|
||||||
jPanel.add(subPanel, BorderLayout.CENTER); |
|
||||||
this.add(jPanel, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
public void update() { |
|
||||||
PredefinedStyle style = selectPane.update(); |
|
||||||
if (style != null) { |
|
||||||
// currentTemplate.resetPredefinedStyle(style.getStyleName());
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void refresh() { |
|
||||||
this.selectPane.refreshPane(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Template_Style"); |
|
||||||
} |
|
||||||
} |
|
@ -1,218 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui; |
|
||||||
|
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.config.predefined.PredefinedStyleConfig; |
|
||||||
import com.fr.config.ServerPreferenceConfig; |
|
||||||
import com.fr.design.actions.UpdateAction; |
|
||||||
import com.fr.design.event.ChangeEvent; |
|
||||||
import com.fr.design.event.ChangeListener; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.mainframe.predefined.PatternStyle; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.FineJOptionPane; |
|
||||||
import com.fr.design.gui.itoolbar.UIToolbar; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.icon.IconPathConstants; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.dialog.PredefinedStyleEditDialog; |
|
||||||
import com.fr.design.menu.MenuDef; |
|
||||||
import com.fr.design.menu.ToolBarDef; |
|
||||||
import com.fr.design.utils.DesignUtils; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
import com.fr.transaction.Configurations; |
|
||||||
import com.fr.transaction.WorkerFacade; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JOptionPane; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.JSeparator; |
|
||||||
import javax.swing.SwingUtilities; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.FlowLayout; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.MouseEvent; |
|
||||||
import java.awt.event.MouseListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-25 |
|
||||||
*/ |
|
||||||
public class ServerPredefinedStylePane extends BasicPane { |
|
||||||
|
|
||||||
private static final Color TIP_COLOR = Color.decode("#8F8F92"); |
|
||||||
private RemoveAction removeAction; |
|
||||||
|
|
||||||
private PredefinedStyleSelectPane selectPane; |
|
||||||
|
|
||||||
|
|
||||||
public ServerPredefinedStylePane() { |
|
||||||
initPane(); |
|
||||||
} |
|
||||||
|
|
||||||
private void initPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Manager")); |
|
||||||
jPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
|
||||||
jPanel.setLayout(FRGUIPaneFactory.createLeftZeroLayout()); |
|
||||||
JPanel subPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
subPanel.add(createControlPane(), BorderLayout.NORTH); |
|
||||||
PredefinedStyle style = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig().getDefaultPredefinedStyle(); |
|
||||||
|
|
||||||
this.selectPane = new PredefinedStyleSelectPane(style == null ? StringUtils.EMPTY : style.getStyleName(), true); |
|
||||||
this.selectPane.registerChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void fireChanged(ChangeEvent event) { |
|
||||||
PredefinedStyle selectStyle = selectPane.getSelectedPreviewPane().update(); |
|
||||||
removeAction.setEnabled(!selectStyle.isBuiltIn()); |
|
||||||
} |
|
||||||
}); |
|
||||||
this.selectPane.addMouseListener(new MouseListener() { |
|
||||||
@Override |
|
||||||
public void mouseClicked(MouseEvent e) { |
|
||||||
if (selectPane.getSelectedPreviewPane() != null) { |
|
||||||
removeAction.setEnabled(true); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mousePressed(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mouseReleased(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mouseEntered(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void mouseExited(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
}); |
|
||||||
JSeparator jSeparator = new JSeparator(); |
|
||||||
subPanel.add(jSeparator, BorderLayout.CENTER); |
|
||||||
subPanel.add(this.selectPane, BorderLayout.SOUTH); |
|
||||||
jPanel.add(subPanel); |
|
||||||
this.add(jPanel, BorderLayout.CENTER); |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private JPanel createControlPane() { |
|
||||||
MenuDef addMenuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Add")); |
|
||||||
addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); |
|
||||||
createAddMenuDef(addMenuDef); |
|
||||||
ToolBarDef toolbarDef = new ToolBarDef(); |
|
||||||
removeAction = new RemoveAction(); |
|
||||||
removeAction.setEnabled(false); |
|
||||||
toolbarDef.addShortCut(addMenuDef, removeAction); |
|
||||||
UIToolbar toolBar = ToolBarDef.createJToolBar(); |
|
||||||
toolBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); |
|
||||||
toolbarDef.updateToolBar(toolBar); |
|
||||||
JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
toolbarPane.add(toolBar, BorderLayout.CENTER); |
|
||||||
UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Manager_Tip")); |
|
||||||
tipLabel.setForeground(TIP_COLOR); |
|
||||||
tipLabel.setHorizontalTextPosition(UILabel.RIGHT); |
|
||||||
toolbarPane.add(tipLabel, BorderLayout.EAST); |
|
||||||
toolbarPane.setPreferredSize(new Dimension(620, 30)); |
|
||||||
return toolbarPane; |
|
||||||
} |
|
||||||
|
|
||||||
private void createAddMenuDef(MenuDef addMenuDef) { |
|
||||||
addMenuDef.setRePaint(true); |
|
||||||
addMenuDef.addShortCut(new CreateStyleAction(PatternStyle.DARK_STYLE)); |
|
||||||
addMenuDef.addShortCut(new CreateStyleAction(PatternStyle.LIGHT_STYLE)); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void update() { |
|
||||||
PredefinedStyle style = selectPane.update(); |
|
||||||
if (style != null) { |
|
||||||
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); |
|
||||||
config.setDefaultPredefinedStyle(style.getStyleName()); |
|
||||||
// Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Server_Style"); |
|
||||||
} |
|
||||||
|
|
||||||
private class RemoveAction extends UpdateAction { |
|
||||||
|
|
||||||
public RemoveAction() { |
|
||||||
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); |
|
||||||
this.setMnemonic('R'); |
|
||||||
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH)); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
PredefinedStyle previewObject = ServerPredefinedStylePane.this.selectPane.update(); |
|
||||||
int selVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ServerPredefinedStylePane.this), |
|
||||||
Toolkit.i18nText("Fine-Design_Predefined_Remove_Style_Confirm", previewObject.getStyleName()), |
|
||||||
Toolkit.i18nText("Fine-Design_Basic_Delete"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); |
|
||||||
if (selVal == JOptionPane.YES_OPTION) { |
|
||||||
removeStyle(previewObject.getStyleName()); |
|
||||||
ServerPredefinedStylePane.this.selectPane.refreshPane(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private class CreateStyleAction extends UpdateAction { |
|
||||||
private PatternStyle style; |
|
||||||
|
|
||||||
public CreateStyleAction(PatternStyle style) { |
|
||||||
this.style = style; |
|
||||||
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Create_Parttern_Style") + style.getName()); |
|
||||||
this.setMnemonic('R'); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
createNewPatternStylePane(); |
|
||||||
} |
|
||||||
|
|
||||||
private void createNewPatternStylePane() { |
|
||||||
PredefinedStyleEditPane editPane = PredefinedStyleEditPane.createNewEditPane(selectPane); |
|
||||||
PredefinedStyleEditDialog editDialog = new PredefinedStyleEditDialog( |
|
||||||
SwingUtilities.getWindowAncestor(ServerPredefinedStylePane.this), editPane); |
|
||||||
PredefinedStyle predefinedStyle = style.getPredefinedStyle(); |
|
||||||
predefinedStyle.setStyleName(StringUtils.EMPTY); |
|
||||||
editPane.populate(predefinedStyle); |
|
||||||
editDialog.setVisible(true); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private void removeStyle(String name) { |
|
||||||
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); |
|
||||||
config.removeStyle(name); |
|
||||||
// Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,308 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.base.Style; |
|
||||||
import com.fr.config.predefined.PredefinedCellStyle; |
|
||||||
import com.fr.config.predefined.PredefinedCellStyleConfig; |
|
||||||
import com.fr.design.actions.UpdateAction; |
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.FineJOptionPane; |
|
||||||
import com.fr.design.gui.NameInspector; |
|
||||||
import com.fr.design.gui.controlpane.JListControlPane; |
|
||||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
|
||||||
import com.fr.design.gui.controlpane.NameableCreator; |
|
||||||
import com.fr.design.gui.controlpane.ShortCut4JControlPane; |
|
||||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
|
||||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
||||||
import com.fr.design.gui.ilist.ListModelElement; |
|
||||||
import com.fr.design.gui.ilist.ModNameActionListener; |
|
||||||
import com.fr.design.gui.style.AlignmentPane; |
|
||||||
import com.fr.design.gui.style.FormatPane; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.cell.CustomPredefinedStylePane; |
|
||||||
import com.fr.design.menu.ShortCut; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.general.NameObject; |
|
||||||
import com.fr.invoke.Reflect; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
import com.fr.stable.Nameable; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JOptionPane; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.JSeparator; |
|
||||||
import javax.swing.SwingConstants; |
|
||||||
import javax.swing.SwingUtilities; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.lang.reflect.Constructor; |
|
||||||
import java.lang.reflect.InvocationTargetException; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Arrays; |
|
||||||
import java.util.Iterator; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-27 |
|
||||||
*/ |
|
||||||
public class CellStyleListControlPane extends JListControlPane { |
|
||||||
private boolean namePermitted = true; |
|
||||||
private AttributeChangeListener attributeChangeListener; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public CellStyleListControlPane() { |
|
||||||
super(); |
|
||||||
this.addModNameActionListener(new ModNameActionListener() { |
|
||||||
public void nameModed(int index, String oldName, String newName) { |
|
||||||
if (ComparatorUtils.equals(oldName, newName) || ComparatorUtils.equals(newName, NameInspector.ILLEGAL_NAME_HOLDER)) { |
|
||||||
return; |
|
||||||
} |
|
||||||
namePermitted = true; |
|
||||||
String[] allNames = nameableList.getAllNames(); |
|
||||||
allNames[index] = StringUtils.EMPTY; |
|
||||||
if (StringUtils.isEmpty(newName)) { |
|
||||||
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index); |
|
||||||
return; |
|
||||||
} |
|
||||||
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) { |
|
||||||
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index); |
|
||||||
return; |
|
||||||
} |
|
||||||
populateSelectedValue(); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void registerAttrChangeListener(AttributeChangeListener listener){ |
|
||||||
this.attributeChangeListener = listener; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private void showTipDialogAndReset(String content, int index) { |
|
||||||
nameableList.stopEditing(); |
|
||||||
|
|
||||||
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(CellStyleListControlPane.this), |
|
||||||
content, |
|
||||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
|
||||||
JOptionPane.WARNING_MESSAGE); |
|
||||||
setIllegalIndex(index); |
|
||||||
namePermitted = false; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public NameableCreator[] createNameableCreators() { |
|
||||||
return new NameableCreator[]{ |
|
||||||
new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), |
|
||||||
PredefinedCellStyle.class, CustomPredefinedStylePaneNoBorder.class) { |
|
||||||
@Override |
|
||||||
public boolean acceptDefaultNameObject(Object ob) { |
|
||||||
return ((PredefinedCellStyle) ob).isDefaultStyle(); |
|
||||||
} |
|
||||||
}, |
|
||||||
new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), |
|
||||||
PredefinedCellStyle.class, CustomPredefinedStylePane.class)}; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public BasicBeanPane createPaneByCreators(NameableCreator creator) { |
|
||||||
CustomPredefinedStylePane stylePane = (CustomPredefinedStylePane) super.createPaneByCreators(creator); |
|
||||||
stylePane.registerAttrChangeListener(attributeChangeListener); |
|
||||||
return stylePane; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return StringUtils.EMPTY; |
|
||||||
} |
|
||||||
|
|
||||||
protected void initComponentPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setCreators(this.createNameableCreators()); |
|
||||||
initCardPane(); |
|
||||||
JPanel leftPane = getLeftPane(); |
|
||||||
JSeparator jSeparator = new JSeparator(SwingConstants.VERTICAL); |
|
||||||
leftPane.setPreferredSize(new Dimension(70, 0)); |
|
||||||
jSeparator.setPreferredSize(new Dimension(2, 0)); |
|
||||||
cardPane.setPreferredSize(new Dimension(238, 0)); |
|
||||||
cardPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
|
||||||
JPanel mainSplitPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
mainSplitPane.add(leftPane, BorderLayout.WEST); |
|
||||||
mainSplitPane.add(jSeparator, BorderLayout.CENTER); |
|
||||||
mainSplitPane.add(cardPane, BorderLayout.EAST); |
|
||||||
|
|
||||||
this.add(mainSplitPane, BorderLayout.CENTER); |
|
||||||
this.checkButtonEnabled(); |
|
||||||
} |
|
||||||
|
|
||||||
protected ShortCut4JControlPane[] createShortcuts() { |
|
||||||
return new ShortCut4JControlPane[]{ |
|
||||||
createAddItemShortCut4JControlPane(), |
|
||||||
new RemoveItemShortCut4JControlPane(new RemoveItemAction()) |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private static class CustomPredefinedStylePaneNoBorder extends CustomPredefinedStylePane { |
|
||||||
@Override |
|
||||||
protected List<BasicPane> initPaneList() { |
|
||||||
paneList = new ArrayList<BasicPane>(); |
|
||||||
paneList.add(new FormatPane()); |
|
||||||
paneList.add(new AlignmentPane()); |
|
||||||
return paneList; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private ShortCut4JControlPane createAddItemShortCut4JControlPane (){ |
|
||||||
ShortCut shortCut = shortCutFactory.createAddItemUpdateAction(new NameableCreator[]{ |
|
||||||
new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), |
|
||||||
PredefinedCellStyle.class, CustomPredefinedStylePane.class)}); |
|
||||||
return new AddItemShortCut4JControlPane(shortCut); |
|
||||||
} |
|
||||||
|
|
||||||
private class AddItemShortCut4JControlPane extends ShortCut4JControlPane{ |
|
||||||
AddItemShortCut4JControlPane(ShortCut shortCut) { |
|
||||||
this.shortCut = shortCut; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void checkEnable() { |
|
||||||
this.shortCut.setEnabled(true); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private class RemoveItemShortCut4JControlPane extends ShortCut4JControlPane { |
|
||||||
RemoveItemShortCut4JControlPane(ShortCut shortCut) { |
|
||||||
this.shortCut = shortCut; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void checkEnable() { |
|
||||||
ListModelElement selectModel = CellStyleListControlPane.this.getSelectedValue(); |
|
||||||
if (selectModel != null) { |
|
||||||
NameObject selectNameObject = (NameObject) selectModel.wrapper; |
|
||||||
PredefinedCellStyle cellStyle = (PredefinedCellStyle) (selectNameObject.getObject()); |
|
||||||
this.shortCut.setEnabled(!cellStyle.isBuiltIn() && !cellStyle.isDefaultStyle()); |
|
||||||
} else { |
|
||||||
this.shortCut.setEnabled(false); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private class RemoveItemAction extends UpdateAction { |
|
||||||
RemoveItemAction() { |
|
||||||
this.setName(com.fr.design.i18n.Toolkit.i18nText(("Fine-Design_Basic_Action_Remove"))); |
|
||||||
this.setMnemonic('R'); |
|
||||||
this.setSmallIcon(BaseUtils |
|
||||||
.readIcon("/com/fr/base/images/cell/control/remove.png")); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent evt) { |
|
||||||
CellStyleListControlPane.this.onRemoveItem(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
class CellStyleNameObjectCreator extends NameObjectCreator { |
|
||||||
public CellStyleNameObjectCreator(String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
|
||||||
super(menuName, clazz, updatePane); |
|
||||||
} |
|
||||||
|
|
||||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
|
||||||
Constructor<? extends PredefinedCellStyle> constructor = null; |
|
||||||
try { |
|
||||||
constructor = clazzOfInitCase.getConstructor(); |
|
||||||
PredefinedCellStyle cellStyle = constructor.newInstance(); |
|
||||||
|
|
||||||
cellStyle.setName(menuName); |
|
||||||
cellStyle.setStyle(Style.getInstance()); |
|
||||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle); |
|
||||||
|
|
||||||
} catch (NoSuchMethodException e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} catch (IllegalAccessException e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} catch (InstantiationException e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} catch (InvocationTargetException e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
/** |
|
||||||
* |
|
||||||
* @param ob |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public Object acceptObject2Populate(Object ob) { |
|
||||||
if (ob instanceof NameObject) { |
|
||||||
ob = ((NameObject) ob).getObject(); |
|
||||||
} |
|
||||||
if (clazzOfObject != null && clazzOfObject.isInstance(ob) && acceptDefaultNameObject(ob)) { |
|
||||||
doSthChanged4Icon(ob); |
|
||||||
return ob; |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean acceptDefaultNameObject(Object ob) { |
|
||||||
return !((PredefinedCellStyle) ob).isDefaultStyle(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Populate |
|
||||||
*/ |
|
||||||
public void populateBean(PredefinedCellStyleConfig ob) { |
|
||||||
if (ob == null) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
List nameStyleList = new ArrayList(); |
|
||||||
|
|
||||||
Iterator styleNameIterator = ob.getStyleNameIterator(); |
|
||||||
while (styleNameIterator.hasNext()) { |
|
||||||
String name = (String) styleNameIterator.next(); |
|
||||||
PredefinedCellStyle tmpStyle = ob.getStyle(name); |
|
||||||
|
|
||||||
if (tmpStyle != null) { |
|
||||||
nameStyleList.add(new NameObject(name, tmpStyle)); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
NameObject[] nameObjects = new NameObject[nameStyleList.size()]; |
|
||||||
nameStyleList.toArray(nameObjects); |
|
||||||
|
|
||||||
populate(nameObjects); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public PredefinedCellStyleConfig updateBean() { |
|
||||||
Nameable[] nameables = this.update(); |
|
||||||
PredefinedCellStyleConfig styleConfig = new PredefinedCellStyleConfig(); |
|
||||||
for (int i = 0; i < nameables.length; i++) { |
|
||||||
PredefinedCellStyle tmpStyle = (PredefinedCellStyle) ((NameObject) nameables[i]).getObject(); |
|
||||||
tmpStyle.setName(nameables[i].getName()); |
|
||||||
styleConfig.addStyle(tmpStyle); |
|
||||||
} |
|
||||||
return styleConfig; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,94 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.MultiTabPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartAxisStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartBackgroundStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartDataSheetStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartLabelStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartLegendStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartTitleStylePane; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-16 |
|
||||||
*/ |
|
||||||
public class ChartStyleSettingPane extends MultiTabPane<PredefinedChartStyle> { |
|
||||||
|
|
||||||
private ChartTitleStylePane chartTitleStylePane; |
|
||||||
private ChartLegendStylePane chartLegendStylePane; |
|
||||||
private ChartLabelStylePane chartLabelPane; |
|
||||||
private ChartAxisStylePane chartAxisStylePane; |
|
||||||
private ChartDataSheetStylePane chartDataSheetStylePane; |
|
||||||
private ChartBackgroundStylePane chartBackgroundStylePane; |
|
||||||
|
|
||||||
public ChartStyleSettingPane() { |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void initLayout() { |
|
||||||
super.initLayout(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected List<BasicPane> initPaneList() { |
|
||||||
this.chartTitleStylePane = new ChartTitleStylePane(); |
|
||||||
this.chartLegendStylePane = new ChartLegendStylePane(); |
|
||||||
this.chartLabelPane = new ChartLabelStylePane(); |
|
||||||
this.chartAxisStylePane = new ChartAxisStylePane(); |
|
||||||
this.chartDataSheetStylePane = new ChartDataSheetStylePane(); |
|
||||||
this.chartBackgroundStylePane = new ChartBackgroundStylePane(); |
|
||||||
paneList = new ArrayList<>(); |
|
||||||
paneList.add(this.chartTitleStylePane); |
|
||||||
paneList.add(this.chartLegendStylePane); |
|
||||||
paneList.add(this.chartLabelPane); |
|
||||||
paneList.add(this.chartAxisStylePane); |
|
||||||
paneList.add(this.chartDataSheetStylePane); |
|
||||||
paneList.add(this.chartBackgroundStylePane); |
|
||||||
return paneList; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(PredefinedChartStyle ob) { |
|
||||||
chartTitleStylePane.populate(ob); |
|
||||||
chartLegendStylePane.populate(ob); |
|
||||||
chartLabelPane.populate(ob); |
|
||||||
chartAxisStylePane.populate(ob); |
|
||||||
chartDataSheetStylePane.populate(ob); |
|
||||||
chartBackgroundStylePane.populate(ob); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void updateBean(PredefinedChartStyle ob) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public PredefinedChartStyle updateBean() { |
|
||||||
PredefinedChartStyle chartStyle = new PredefinedChartStyle(); |
|
||||||
chartTitleStylePane.update(chartStyle); |
|
||||||
chartLegendStylePane.update(chartStyle); |
|
||||||
chartLabelPane.update(chartStyle); |
|
||||||
chartAxisStylePane.update(chartStyle); |
|
||||||
chartDataSheetStylePane.update(chartStyle); |
|
||||||
chartBackgroundStylePane.update(chartStyle); |
|
||||||
return chartStyle; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean accept(Object ob) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void reset() { |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,63 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedComponentStyle; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.MultiTabPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.component.ComponentFrameStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.component.ComponentTitleStylePane; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-01 |
|
||||||
*/ |
|
||||||
public class ComponentStyleSettingPane extends MultiTabPane<PredefinedComponentStyle> { |
|
||||||
private ComponentFrameStylePane frameStylePane; |
|
||||||
private ComponentTitleStylePane titleStylePane; |
|
||||||
|
|
||||||
public ComponentStyleSettingPane() { |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected List<BasicPane> initPaneList() { |
|
||||||
this.frameStylePane = new ComponentFrameStylePane(); |
|
||||||
this.titleStylePane = ComponentTitleStylePane.createPredefinedSettingPane(); |
|
||||||
paneList = new ArrayList<BasicPane>(); |
|
||||||
paneList.add(this.frameStylePane); |
|
||||||
paneList.add(this.titleStylePane); |
|
||||||
return paneList; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(PredefinedComponentStyle ob) { |
|
||||||
this.frameStylePane.populate(ob); |
|
||||||
this.titleStylePane.populate(ob); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void updateBean(PredefinedComponentStyle ob) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public PredefinedComponentStyle updateBean() { |
|
||||||
PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); |
|
||||||
this.frameStylePane.update(componentStyle); |
|
||||||
this.titleStylePane.update(componentStyle); |
|
||||||
return componentStyle; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean accept(Object ob) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void reset() { |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,81 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedBackground; |
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundWithAlphaSettingPane; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.CardLayout; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-31 |
|
||||||
*/ |
|
||||||
public class PredefinedBackgroundSettingPane extends BasicBeanPane<PredefinedBackground> { |
|
||||||
private UIButtonGroup buttonGroup; |
|
||||||
private BackgroundSettingPane reportBackgroundSettingPane; |
|
||||||
private BackgroundWithAlphaSettingPane formBackgroundSettingPane; |
|
||||||
|
|
||||||
|
|
||||||
public PredefinedBackgroundSettingPane() { |
|
||||||
initPane(); |
|
||||||
} |
|
||||||
|
|
||||||
private void initPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
reportBackgroundSettingPane = new BackgroundSettingPane(); |
|
||||||
formBackgroundSettingPane = new BackgroundWithAlphaSettingPane(); |
|
||||||
CardLayout tabbedPane = new CardLayout(); |
|
||||||
JPanel center = new JPanel(tabbedPane); |
|
||||||
center.add(reportBackgroundSettingPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report")); |
|
||||||
center.add(formBackgroundSettingPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report")); |
|
||||||
this.buttonGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report"), |
|
||||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report")}); |
|
||||||
buttonGroup.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
if (buttonGroup.getSelectedIndex() == 0) { |
|
||||||
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plain_Report")); |
|
||||||
} else { |
|
||||||
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Decision_Report")); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
this.add(buttonGroup, BorderLayout.NORTH); |
|
||||||
|
|
||||||
this.add(center, BorderLayout.CENTER); |
|
||||||
this.buttonGroup.setSelectedIndex(0); |
|
||||||
} |
|
||||||
|
|
||||||
public boolean currentFormBackground() { |
|
||||||
return buttonGroup.getSelectedIndex() == 1; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(PredefinedBackground predefinedBackground) { |
|
||||||
reportBackgroundSettingPane.populateBean(predefinedBackground.getReportBackground()); |
|
||||||
formBackgroundSettingPane.populateBean(predefinedBackground.getFormBackground()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public PredefinedBackground updateBean() { |
|
||||||
PredefinedBackground predefinedBackground = new PredefinedBackground(); |
|
||||||
predefinedBackground.setReportBackground(reportBackgroundSettingPane.updateBean()); |
|
||||||
predefinedBackground.setFormBackground(formBackgroundSettingPane.updateBean()); |
|
||||||
return predefinedBackground; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Background_Setting"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,51 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; |
|
||||||
import com.fr.general.Background; |
|
||||||
|
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-14 |
|
||||||
*/ |
|
||||||
public abstract class AbstractBackgroundDetailPane<T extends Background> extends BackgroundQuickPane { |
|
||||||
@Override |
|
||||||
public boolean accept(Background background) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(Background background) { |
|
||||||
this.populate((T) background); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public Background updateBean() { |
|
||||||
return this.update(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void reset() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void registerChangeListener(UIObserverListener listener) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public abstract void populate(T background); |
|
||||||
|
|
||||||
public abstract T update(); |
|
||||||
|
|
||||||
public void addChangeListener(ChangeListener changeListener) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,135 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.CardLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.event.ItemEvent; |
|
||||||
import java.awt.event.ItemListener; |
|
||||||
import java.util.ArrayList; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public class BackgroundSettingPane extends BasicBeanPane<Background> { |
|
||||||
private ChangeListener changeListener = null; |
|
||||||
private UIComboBox headCombobox; |
|
||||||
private BackgroundQuickPane[] paneList; |
|
||||||
|
|
||||||
public BackgroundSettingPane() { |
|
||||||
init(); |
|
||||||
} |
|
||||||
|
|
||||||
private void init() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.add(createComboHeadPane(), BorderLayout.NORTH); |
|
||||||
CardLayout cardlayout = new CardLayout(); |
|
||||||
paneList = supportKindsOfBackgroundUI(); |
|
||||||
final JPanel centerPane = new JPanel(cardlayout) { |
|
||||||
@Override |
|
||||||
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
|
|
||||||
int index = headCombobox.getSelectedIndex(); |
|
||||||
return new Dimension(super.getPreferredSize().width, paneList[index].getPreferredSize().height); |
|
||||||
} |
|
||||||
}; |
|
||||||
centerPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
|
||||||
for (BackgroundQuickPane pane : paneList) { |
|
||||||
headCombobox.addItem(pane.title4PopupWindow()); |
|
||||||
centerPane.add(pane, pane.title4PopupWindow()); |
|
||||||
} |
|
||||||
headCombobox.addItemListener(new ItemListener() { |
|
||||||
@Override |
|
||||||
public void itemStateChanged(ItemEvent e) { |
|
||||||
cardlayout.show(centerPane, (String) headCombobox.getSelectedItem()); |
|
||||||
} |
|
||||||
}); |
|
||||||
this.add(centerPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
public void addChangeListener(ChangeListener changeListener) { |
|
||||||
this.changeListener = changeListener; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private JPanel createComboHeadPane() { |
|
||||||
headCombobox = new UIComboBox(); |
|
||||||
|
|
||||||
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( |
|
||||||
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill")), headCombobox}}, |
|
||||||
TableLayoutHelper.FILL_NONE, 33, 5); |
|
||||||
headCombobox.setPreferredSize(new Dimension(160, 20)); |
|
||||||
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() { |
|
||||||
java.util.List<BackgroundQuickPane> kinds = new ArrayList<>(); |
|
||||||
kinds.add(new EmptyBackgroundPane()); |
|
||||||
kinds.add(new ColorDetailPane()); |
|
||||||
kinds.add(new TextureDetailObservePane()); |
|
||||||
kinds.add(new PatternDetailPane()); |
|
||||||
kinds.add(createImageSelectPane()); |
|
||||||
kinds.add(new GradientDetailPane()); |
|
||||||
return kinds.toArray(new BackgroundQuickPane[kinds.size()]); |
|
||||||
} |
|
||||||
|
|
||||||
protected ImageDetailPane createImageSelectPane() { |
|
||||||
ImageDetailPane imageDetailPane = new ImageDetailPane(); |
|
||||||
imageDetailPane.registerChangeListener(new UIObserverListener() { |
|
||||||
@Override |
|
||||||
public void doChange() { |
|
||||||
fireChangeListener(); |
|
||||||
} |
|
||||||
}); |
|
||||||
return imageDetailPane; |
|
||||||
} |
|
||||||
|
|
||||||
protected void fireChangeListener() { |
|
||||||
if (changeListener != null) { |
|
||||||
changeListener.stateChanged(null); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(Background background) { |
|
||||||
for (int i = 0; i < paneList.length; i++) { |
|
||||||
BackgroundQuickPane pane = paneList[i]; |
|
||||||
if (pane.accept(background)) { |
|
||||||
pane.populateBean(background); |
|
||||||
headCombobox.setSelectedIndex(i); |
|
||||||
return; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public Background updateBean() { |
|
||||||
int selectIndex = this.headCombobox.getSelectedIndex(); |
|
||||||
try { |
|
||||||
return paneList[selectIndex].updateBean(); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,76 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.config.predefined.BackgroundWithAlpha; |
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.designer.IntervalConstants; |
|
||||||
import com.fr.design.gui.frpane.UINumberDragPane; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-04 |
|
||||||
*/ |
|
||||||
public class BackgroundWithAlphaSettingPane extends BasicBeanPane<BackgroundWithAlpha> { |
|
||||||
private BackgroundSettingPane backgroundSettingPane; |
|
||||||
//透明度
|
|
||||||
private UINumberDragPane numberDragPane; |
|
||||||
|
|
||||||
private double maxNumber = 100; |
|
||||||
|
|
||||||
|
|
||||||
public BackgroundWithAlphaSettingPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
backgroundSettingPane = new FormBackgroundSettingPane(); |
|
||||||
|
|
||||||
JPanel eastpane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(2, 0); |
|
||||||
this.numberDragPane = new UINumberDragPane(0, 100); |
|
||||||
this.numberDragPane.setPreferredSize(new Dimension(148, 20)); |
|
||||||
eastpane.add(numberDragPane); |
|
||||||
eastpane.add(new UILabel("%")); |
|
||||||
JPanel transparencyPane = TableLayoutHelper.createGapTableLayoutPane( |
|
||||||
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha")), |
|
||||||
eastpane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 5); |
|
||||||
transparencyPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); |
|
||||||
|
|
||||||
|
|
||||||
Component[][] components = new Component[][]{ |
|
||||||
new Component[]{backgroundSettingPane}, |
|
||||||
new Component[]{transparencyPane}}; |
|
||||||
|
|
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_NONE, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); |
|
||||||
this.add(panel, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void addChangeListener(ChangeListener changeListener) { |
|
||||||
this.backgroundSettingPane.addChangeListener(changeListener); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(BackgroundWithAlpha ob) { |
|
||||||
backgroundSettingPane.populateBean(ob.getBackground()); |
|
||||||
numberDragPane.populateBean(ob.getAlpha() * maxNumber); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public BackgroundWithAlpha updateBean() { |
|
||||||
BackgroundWithAlpha backgroundWithAlpha = new BackgroundWithAlpha(); |
|
||||||
backgroundWithAlpha.setBackground(backgroundSettingPane.updateBean()); |
|
||||||
backgroundWithAlpha.setAlpha((float) (numberDragPane.updateBean() / maxNumber)); |
|
||||||
return backgroundWithAlpha; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,56 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.base.background.ColorBackground; |
|
||||||
import com.fr.design.event.UIObserver; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.style.color.NewColorSelectPane; |
|
||||||
import com.fr.general.Background; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-31 |
|
||||||
*/ |
|
||||||
public class ColorDetailPane extends AbstractBackgroundDetailPane<ColorBackground> { |
|
||||||
private ColorBackgroundSelectPane selectPane; |
|
||||||
|
|
||||||
|
|
||||||
public ColorDetailPane() { |
|
||||||
this.selectPane = new ColorBackgroundSelectPane(); |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.add(this.selectPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(ColorBackground background) { |
|
||||||
this.selectPane.setColor(background.getColor()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public ColorBackground update() { |
|
||||||
return ColorBackground.getInstance(selectPane.getColor()); |
|
||||||
} |
|
||||||
|
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean accept(Background background) { |
|
||||||
return background instanceof ColorBackground; |
|
||||||
} |
|
||||||
|
|
||||||
class ColorBackgroundSelectPane extends NewColorSelectPane implements UIObserver { |
|
||||||
protected UIObserverListener uiObserverListener; |
|
||||||
|
|
||||||
@Override |
|
||||||
public void registerChangeListener(UIObserverListener listener) { |
|
||||||
this.uiObserverListener = listener; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean shouldResponseChangeListener() { |
|
||||||
return true; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,34 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.general.Background; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-01 |
|
||||||
*/ |
|
||||||
public class EmptyBackgroundPane extends AbstractBackgroundDetailPane { |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(Background background) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public Background update() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 名称 |
|
||||||
* |
|
||||||
* @return 名称 |
|
||||||
*/ |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Null"); |
|
||||||
} |
|
||||||
|
|
||||||
public boolean accept(Background background) { |
|
||||||
return background == null; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,48 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.design.ExtraDesignClassManager; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.fun.BackgroundQuickUIProvider; |
|
||||||
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Set; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-14 |
|
||||||
*/ |
|
||||||
public class FormBackgroundSettingPane extends BackgroundSettingPane { |
|
||||||
|
|
||||||
public FormBackgroundSettingPane() { |
|
||||||
super(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() { |
|
||||||
ColorDetailPane colorDetailPane = new ColorDetailPane(); |
|
||||||
ImageDetailPane imageDetailPane = createImageSelectPane(); |
|
||||||
GradientDetailPane gradientPane = new GradientDetailPane(); |
|
||||||
//hugh:表单支持背景接口
|
|
||||||
List<BackgroundQuickPane> kinds = new ArrayList<BackgroundQuickPane>(); |
|
||||||
|
|
||||||
kinds.add(new EmptyBackgroundPane()); |
|
||||||
kinds.add(colorDetailPane); |
|
||||||
kinds.add(imageDetailPane); |
|
||||||
kinds.add(gradientPane); |
|
||||||
|
|
||||||
Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING); |
|
||||||
for (BackgroundQuickUIProvider provider : providers) { |
|
||||||
BackgroundQuickPane newTypePane = provider.appearanceForBackground(); |
|
||||||
newTypePane.registerChangeListener(new UIObserverListener() { |
|
||||||
@Override |
|
||||||
public void doChange() { |
|
||||||
fireChangeListener(); |
|
||||||
} |
|
||||||
}); |
|
||||||
kinds.add(newTypePane); |
|
||||||
} |
|
||||||
|
|
||||||
return kinds.toArray(new BackgroundQuickPane[kinds.size()]); |
|
||||||
} |
|
||||||
} |
|
@ -1,159 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.base.background.GradientBackground; |
|
||||||
import com.fr.design.designer.IntervalConstants; |
|
||||||
import com.fr.design.event.UIObserver; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.gui.ibutton.UIRadioButton; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.style.background.gradient.GradientBar; |
|
||||||
import com.fr.general.Background; |
|
||||||
|
|
||||||
import javax.swing.ButtonGroup; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.GridLayout; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* 渐变色的面板,不是很pp,面板应用显得繁琐,有写可以写成控件类型,比如色彩选择的。。,可以做得花哨点 |
|
||||||
* |
|
||||||
* @author ben |
|
||||||
*/ |
|
||||||
public class GradientDetailPane extends AbstractBackgroundDetailPane<GradientBackground> implements UIObserver { |
|
||||||
private static final long serialVersionUID = -6854603990673031897L; |
|
||||||
private UIObserverListener listener; |
|
||||||
private UIRadioButton left2right, top2bottom; |
|
||||||
private GradientBar gradientBar; |
|
||||||
private ChangeListener changeListener = null; |
|
||||||
|
|
||||||
public GradientDetailPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
|
|
||||||
JPanel gradientPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel blankJp = new JPanel(); |
|
||||||
gradientBar = new GradientBar(4, 140); |
|
||||||
blankJp.add(gradientBar); |
|
||||||
|
|
||||||
gradientPanel.add(gradientBar, BorderLayout.SOUTH); |
|
||||||
|
|
||||||
JPanel jp = new JPanel(new GridLayout(2, 1, 15, 10)); |
|
||||||
|
|
||||||
|
|
||||||
left2right = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Page_Setup_Horizontal")); |
|
||||||
jp.add(left2right); |
|
||||||
left2right.setSelected(true); |
|
||||||
left2right.addActionListener(reviewListener); |
|
||||||
|
|
||||||
top2bottom = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Page_Setup_Vertical")); |
|
||||||
jp.add(top2bottom); |
|
||||||
top2bottom.addActionListener(reviewListener); |
|
||||||
|
|
||||||
ButtonGroup toggle = new ButtonGroup(); |
|
||||||
toggle.add(left2right); |
|
||||||
toggle.add(top2bottom); |
|
||||||
|
|
||||||
Component[][] components = new Component[][]{ |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Gradient_Setting")), gradientPanel}, |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Gradient_Color")), jp} |
|
||||||
}; |
|
||||||
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, |
|
||||||
IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1); |
|
||||||
this.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
if (listener != null) { |
|
||||||
listener.doChange(); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
this.add(contentPane); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean accept(Background background) { |
|
||||||
return background instanceof GradientBackground; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void populate(GradientBackground bg) { |
|
||||||
this.gradientBar.getSelectColorPointBtnP1().setColorInner(bg.getStartColor()); |
|
||||||
this.gradientBar.getSelectColorPointBtnP2().setColorInner(bg.getEndColor()); |
|
||||||
if (bg.getDirection() == GradientBackground.LEFT2RIGHT) { |
|
||||||
left2right.setSelected(true); |
|
||||||
} else { |
|
||||||
top2bottom.setSelected(true); |
|
||||||
} |
|
||||||
if (bg.isUseCell()) { |
|
||||||
return; |
|
||||||
} |
|
||||||
double startValue = (double) bg.getBeginPlace(); |
|
||||||
double endValue = (double) bg.getFinishPlace(); |
|
||||||
gradientBar.setStartValue(startValue); |
|
||||||
gradientBar.setEndValue(endValue); |
|
||||||
this.gradientBar.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
public GradientBackground update() { |
|
||||||
GradientBackground gb = new GradientBackground( |
|
||||||
gradientBar.getSelectColorPointBtnP1().getColorInner(), |
|
||||||
gradientBar.getSelectColorPointBtnP2().getColorInner()); |
|
||||||
if (left2right.isSelected()) { |
|
||||||
gb.setDirection(GradientBackground.LEFT2RIGHT); |
|
||||||
} else { |
|
||||||
gb.setDirection(GradientBackground.TOP2BOTTOM); |
|
||||||
} |
|
||||||
if (gradientBar.isOriginalPlace()) { |
|
||||||
gb.setUseCell(true); |
|
||||||
} else { |
|
||||||
gb.setUseCell(false); |
|
||||||
gb.setBeginPlace((float) gradientBar.getStartValue()); |
|
||||||
gb.setFinishPlace((float) gradientBar.getEndValue()); |
|
||||||
} |
|
||||||
return gb; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
ActionListener reviewListener = new ActionListener() { |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
fireChagneListener(); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
public void addChangeListener(ChangeListener changeListener) { |
|
||||||
this.changeListener = changeListener; |
|
||||||
gradientBar.addChangeListener(changeListener); |
|
||||||
} |
|
||||||
|
|
||||||
public void fireChagneListener() { |
|
||||||
if (this.changeListener != null) { |
|
||||||
ChangeEvent evt = new ChangeEvent(this); |
|
||||||
this.changeListener.stateChanged(evt); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void registerChangeListener(UIObserverListener listener) { |
|
||||||
this.listener = listener; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean shouldResponseChangeListener() { |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradient_Color"); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,215 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.base.Style; |
|
||||||
import com.fr.base.background.ImageBackground; |
|
||||||
import com.fr.base.background.ImageFileBackground; |
|
||||||
import com.fr.design.designer.IntervalConstants; |
|
||||||
import com.fr.design.event.UIObserver; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.gui.frpane.ImgChooseWrapper; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.gui.ibutton.UIRadioButton; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.style.background.image.ImageFileChooser; |
|
||||||
import com.fr.design.style.background.image.ImagePreviewPane; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.stable.Constants; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.ButtonGroup; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.GridLayout; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* Image background pane. |
|
||||||
*/ |
|
||||||
public class ImageDetailPane extends AbstractBackgroundDetailPane<ImageBackground> implements UIObserver { |
|
||||||
private UIObserverListener listener; |
|
||||||
protected ImagePreviewPane previewPane = null; |
|
||||||
private Style imageStyle = null; |
|
||||||
private ChangeListener changeListener = null; |
|
||||||
private ImageFileChooser imageFileChooser = null; |
|
||||||
|
|
||||||
private UIRadioButton defaultRadioButton = null; |
|
||||||
private UIRadioButton tiledRadioButton = null; |
|
||||||
private UIRadioButton extendRadioButton = null; |
|
||||||
private UIRadioButton adjustRadioButton = null; |
|
||||||
|
|
||||||
|
|
||||||
public ImageDetailPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.add(initSelectFilePane(), BorderLayout.CENTER); |
|
||||||
imageFileChooser = new ImageFileChooser(); |
|
||||||
imageFileChooser.setMultiSelectionEnabled(false); |
|
||||||
previewPane = new ImagePreviewPane(); |
|
||||||
this.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
if (listener != null) { |
|
||||||
listener.doChange(); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
public JPanel initSelectFilePane() { |
|
||||||
JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
||||||
selectFilePane.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
UIButton selectPictureButton = new UIButton( |
|
||||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select")); |
|
||||||
selectPictureButton.setMnemonic('S'); |
|
||||||
selectPictureButton.addActionListener(selectPictureActionListener); |
|
||||||
selectPictureButton.setPreferredSize(new Dimension(160, 20)); |
|
||||||
//布局
|
|
||||||
defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Default")); |
|
||||||
tiledRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Titled")); |
|
||||||
extendRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Extend")); |
|
||||||
adjustRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Adjust")); |
|
||||||
|
|
||||||
defaultRadioButton.addActionListener(layoutActionListener); |
|
||||||
tiledRadioButton.addActionListener(layoutActionListener); |
|
||||||
extendRadioButton.addActionListener(layoutActionListener); |
|
||||||
adjustRadioButton.addActionListener(layoutActionListener); |
|
||||||
|
|
||||||
JPanel jp = new JPanel(new GridLayout(4, 1, 15, 10)); |
|
||||||
for (UIRadioButton button : imageLayoutButtons()) { |
|
||||||
jp.add(button); |
|
||||||
} |
|
||||||
|
|
||||||
ButtonGroup layoutBG = new ButtonGroup(); |
|
||||||
layoutBG.add(defaultRadioButton); |
|
||||||
layoutBG.add(tiledRadioButton); |
|
||||||
layoutBG.add(extendRadioButton); |
|
||||||
layoutBG.add(adjustRadioButton); |
|
||||||
|
|
||||||
defaultRadioButton.setSelected(true); |
|
||||||
|
|
||||||
Component[][] components = new Component[][]{ |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image")), selectPictureButton}, |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Fill_Mode")), jp} |
|
||||||
}; |
|
||||||
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_NONE, |
|
||||||
IntervalConstants.INTERVAL_L4, IntervalConstants.INTERVAL_L1); |
|
||||||
selectFilePane.add(centerPane, BorderLayout.CENTER); |
|
||||||
return selectFilePane; |
|
||||||
} |
|
||||||
|
|
||||||
protected UIRadioButton[] imageLayoutButtons() { |
|
||||||
return new UIRadioButton[]{ |
|
||||||
defaultRadioButton, |
|
||||||
tiledRadioButton, |
|
||||||
extendRadioButton, |
|
||||||
adjustRadioButton |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean accept(Background background) { |
|
||||||
return background instanceof ImageBackground; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Select picture. |
|
||||||
*/ |
|
||||||
ActionListener selectPictureActionListener = new ActionListener() { |
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent evt) { |
|
||||||
int returnVal = imageFileChooser.showOpenDialog(ImageDetailPane.this); |
|
||||||
setImageStyle(); |
|
||||||
ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, changeListener).dealWithImageFile(returnVal); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
protected void setImageStyle() { |
|
||||||
if (tiledRadioButton.isSelected()) { |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); |
|
||||||
} else if (adjustRadioButton.isSelected()) { |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST); |
|
||||||
} else if (extendRadioButton.isSelected()) { |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND); |
|
||||||
} else { |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
ActionListener layoutActionListener = new ActionListener() { |
|
||||||
|
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent evt) { |
|
||||||
setImageStyle(); |
|
||||||
changeImageStyle(); |
|
||||||
} |
|
||||||
|
|
||||||
private void changeImageStyle() { |
|
||||||
previewPane.setImageStyle(ImageDetailPane.this.imageStyle); |
|
||||||
previewPane.repaint(); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(ImageBackground imageBackground) { |
|
||||||
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) { |
|
||||||
defaultRadioButton.setSelected(true); |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); |
|
||||||
} else if (imageBackground.getLayout() == Constants.IMAGE_EXTEND) { |
|
||||||
extendRadioButton.setSelected(true); |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND); |
|
||||||
} else if (imageBackground.getLayout() == Constants.IMAGE_ADJUST) { |
|
||||||
adjustRadioButton.setSelected(true); |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST); |
|
||||||
} else { |
|
||||||
tiledRadioButton.setSelected(true); |
|
||||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); |
|
||||||
} |
|
||||||
previewPane.setImageStyle(ImageDetailPane.this.imageStyle); |
|
||||||
if (imageBackground.getImage() != null) { |
|
||||||
previewPane.setImageWithSuffix(imageBackground.getImageWithSuffix()); |
|
||||||
previewPane.setImage(imageBackground.getImage()); |
|
||||||
} |
|
||||||
|
|
||||||
fireChagneListener(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public ImageBackground update() { |
|
||||||
ImageBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix()); |
|
||||||
setImageStyle(); |
|
||||||
imageBackground.setLayout(imageStyle.getImageLayout()); |
|
||||||
return imageBackground; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void addChangeListener(ChangeListener changeListener) { |
|
||||||
this.changeListener = changeListener; |
|
||||||
} |
|
||||||
|
|
||||||
private void fireChagneListener() { |
|
||||||
if (this.changeListener != null) { |
|
||||||
ChangeEvent evt = new ChangeEvent(this); |
|
||||||
this.changeListener.stateChanged(evt); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void registerChangeListener(UIObserverListener listener) { |
|
||||||
this.listener = listener; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,119 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.base.background.PatternBackground; |
|
||||||
import com.fr.design.designer.IntervalConstants; |
|
||||||
import com.fr.design.event.UIObserver; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.style.background.impl.PatternBackgroundPane; |
|
||||||
import com.fr.design.style.color.ColorSelectBox; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.SwingConstants; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.GridLayout; |
|
||||||
import java.awt.LayoutManager; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-31 |
|
||||||
*/ |
|
||||||
public class PatternDetailPane extends AbstractBackgroundDetailPane<PatternBackground> implements UIObserver { |
|
||||||
|
|
||||||
private UIObserverListener listener; |
|
||||||
private PatternNewBackgroundPane patternNewBackgroundPane; |
|
||||||
|
|
||||||
public PatternDetailPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
patternNewBackgroundPane = new PatternNewBackgroundPane(6); |
|
||||||
this.add(patternNewBackgroundPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void registerChangeListener(UIObserverListener listener) { |
|
||||||
this.listener = listener; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(PatternBackground background) { |
|
||||||
this.patternNewBackgroundPane.populate(background); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public PatternBackground update() { |
|
||||||
try { |
|
||||||
return (PatternBackground) this.patternNewBackgroundPane.update(); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean accept(Background background) { |
|
||||||
return background instanceof PatternBackground; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean shouldResponseChangeListener() { |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
class PatternNewBackgroundPane extends PatternBackgroundPane { |
|
||||||
private PatternNewBackgroundPane(int nColumn) { |
|
||||||
super(nColumn); |
|
||||||
} |
|
||||||
|
|
||||||
protected LayoutManager layoutOfTypePane(int nColumn) { |
|
||||||
return new GridLayout(0, nColumn, 2, 2); |
|
||||||
} |
|
||||||
|
|
||||||
protected void initComponents(int nColumn) { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
JPanel jPanel = new JPanel(); |
|
||||||
jPanel.setLayout(layoutOfTypePane(nColumn)); |
|
||||||
setChildrenOfTypePane(jPanel); |
|
||||||
|
|
||||||
foregroundColorPane = new ColorSelectBox(80); |
|
||||||
backgroundColorPane = new ColorSelectBox(80); |
|
||||||
foregroundColorPane.setSelectObject(Color.lightGray); |
|
||||||
backgroundColorPane.setSelectObject(Color.black); |
|
||||||
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern")); |
|
||||||
label.setVerticalAlignment(SwingConstants.TOP); |
|
||||||
Component[][] components = new Component[][]{ |
|
||||||
new Component[]{label, jPanel}, |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_ForeBackground_Color")), foregroundColorPane}, |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Pattern_Color")), backgroundColorPane} |
|
||||||
}; |
|
||||||
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, |
|
||||||
IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1); |
|
||||||
JPanel jPanel1 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
||||||
jPanel1.add(centerPane); |
|
||||||
jPanel1.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
this.add(jPanel1, BorderLayout.NORTH); |
|
||||||
this.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
if (listener != null) { |
|
||||||
listener.doChange(); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,97 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.background; |
|
||||||
|
|
||||||
import com.fr.base.background.TextureBackground; |
|
||||||
import com.fr.design.event.UIObserver; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.style.background.texture.TextureDetailPane; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.SwingConstants; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public class TextureDetailObservePane extends AbstractBackgroundDetailPane<TextureBackground> implements UIObserver { |
|
||||||
private TextureDetailPane detailPane; |
|
||||||
|
|
||||||
private UIObserverListener listener; |
|
||||||
|
|
||||||
public TextureDetailObservePane() { |
|
||||||
|
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
detailPane = TextureDetailPane.createMiniTextureDetailPane(6); |
|
||||||
|
|
||||||
detailPane.setPreferredSize(new Dimension(160, 108)); |
|
||||||
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture")); |
|
||||||
label.setPreferredSize(new Dimension(24, 108)); |
|
||||||
label.setVerticalAlignment(SwingConstants.TOP); |
|
||||||
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( |
|
||||||
new Component[][]{new Component[]{label, detailPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 33, 5); |
|
||||||
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10)); |
|
||||||
|
|
||||||
|
|
||||||
detailPane.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
if (listener != null) { |
|
||||||
listener.doChange(); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
this.add(jPanel, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void registerChangeListener(UIObserverListener listener) { |
|
||||||
this.listener = listener; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean shouldResponseChangeListener() { |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(TextureBackground background) { |
|
||||||
this.detailPane.populate(background); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public TextureBackground update() { |
|
||||||
try { |
|
||||||
return (TextureBackground) this.detailPane.update(); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean accept(Background background) { |
|
||||||
return background instanceof TextureBackground; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void addChangeListener(ChangeListener changeListener) { |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,223 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.cell; |
|
||||||
|
|
||||||
import com.fr.base.ScreenResolution; |
|
||||||
import com.fr.base.Style; |
|
||||||
import com.fr.config.predefined.PredefinedCellStyle; |
|
||||||
import com.fr.design.constants.UIConstants; |
|
||||||
import com.fr.design.dialog.AttrScrollPane; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.BasicScrollPane; |
|
||||||
import com.fr.design.dialog.MultiTabPane; |
|
||||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
|
||||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
||||||
import com.fr.design.gui.style.AbstractBasicStylePane; |
|
||||||
import com.fr.design.gui.style.AlignmentPane; |
|
||||||
import com.fr.design.gui.style.BorderPane; |
|
||||||
import com.fr.design.gui.style.FormatPane; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JComponent; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.awt.GridLayout; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 哎,复杂的原型图导致复杂的画法。非我所愿也 |
|
||||||
* |
|
||||||
* @author zhou |
|
||||||
* @since 2012-5-24上午10:36:10 |
|
||||||
*/ |
|
||||||
public class CustomPredefinedStylePane extends MultiTabPane<PredefinedCellStyle> { |
|
||||||
private PredefinedCellStyle cellStyle; |
|
||||||
private PreviewArea previewArea; |
|
||||||
private boolean populating; |
|
||||||
private AttributeChangeListener attributeChangeListener; |
|
||||||
|
|
||||||
|
|
||||||
public CustomPredefinedStylePane() { |
|
||||||
super(); |
|
||||||
tabPane.setOneLineTab(true); |
|
||||||
tabPane.setDrawLine(false); |
|
||||||
tabPane.setBorder(BorderFactory.createLineBorder(UIConstants.SHADOW_GREY)); |
|
||||||
tabPane.setLayout(new GridLayout(1, 3, 0, 0)); |
|
||||||
} |
|
||||||
|
|
||||||
public void registerAttrChangeListener(AttributeChangeListener listener){ |
|
||||||
this.attributeChangeListener = listener; |
|
||||||
} |
|
||||||
|
|
||||||
private void fireAttrChangeListener() { |
|
||||||
if (this.attributeChangeListener != null) { |
|
||||||
this.attributeChangeListener.attributeChange(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Style"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void reset() { |
|
||||||
populateBean(null); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void populateBean(PredefinedCellStyle ob) { |
|
||||||
this.populating = true; |
|
||||||
this.cellStyle = ob; |
|
||||||
for (int i = 0; i < paneList.size(); i++) { |
|
||||||
((AbstractBasicStylePane) paneList.get(i)).populateBean(ob.getStyle()); |
|
||||||
previewArea.preview(ob.getStyle()); |
|
||||||
} |
|
||||||
this.populating = false; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public PredefinedCellStyle updateBean() { |
|
||||||
AbstractBasicStylePane basicStylePane = (AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex()); |
|
||||||
this.cellStyle.setStyle(basicStylePane.update(this.cellStyle.getStyle())); |
|
||||||
return this.cellStyle; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @param ob |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public boolean accept(Object ob) { |
|
||||||
return ob instanceof PredefinedCellStyle; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected List<BasicPane> initPaneList() { |
|
||||||
paneList = new ArrayList<BasicPane>(); |
|
||||||
paneList.add(new FormatPane()); |
|
||||||
paneList.add(new BorderPane()); |
|
||||||
paneList.add(new AlignmentPane()); |
|
||||||
return paneList; |
|
||||||
} |
|
||||||
|
|
||||||
protected void initLayout() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
|
|
||||||
JPanel jPanel = new JPanel(); |
|
||||||
jPanel.setLayout(new BorderLayout(0, 4)); |
|
||||||
|
|
||||||
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
previewArea = new PreviewArea(); |
|
||||||
previewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null)); |
|
||||||
previewPane.add(previewArea, BorderLayout.CENTER); |
|
||||||
|
|
||||||
this.add(previewPane, BorderLayout.NORTH); |
|
||||||
|
|
||||||
this.add(jPanel, BorderLayout.CENTER); |
|
||||||
jPanel.add(tabPane, BorderLayout.NORTH); |
|
||||||
JPanel attrListenerPane = new AbstractAttrNoScrollPane() { |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void initContentPane() { |
|
||||||
leftContentPane = createContentPane(); |
|
||||||
this.add(leftContentPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createContentPane() { |
|
||||||
this.addAttributeChangeListener(new AttributeChangeListener() { |
|
||||||
@Override |
|
||||||
public void attributeChange() { |
|
||||||
if (populating) { |
|
||||||
return; |
|
||||||
} |
|
||||||
PredefinedCellStyle cellStyle = updateBean(); |
|
||||||
if (cellStyle != null) { |
|
||||||
previewArea.preview(cellStyle.getStyle()); |
|
||||||
} |
|
||||||
fireAttrChangeListener(); |
|
||||||
} |
|
||||||
}); |
|
||||||
BasicScrollPane basicScrollPane = new AttrScrollPane() { |
|
||||||
@Override |
|
||||||
protected JPanel createContentPane() { |
|
||||||
return centerPane; |
|
||||||
} |
|
||||||
}; |
|
||||||
return basicScrollPane; |
|
||||||
} |
|
||||||
}; |
|
||||||
jPanel.add(attrListenerPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void updateBean(PredefinedCellStyle ob) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 预览Style的面板 |
|
||||||
* |
|
||||||
* @author richer |
|
||||||
*/ |
|
||||||
private static class PreviewArea extends JComponent { |
|
||||||
|
|
||||||
private String paintText = "Report"; |
|
||||||
private Style style = Style.DEFAULT_STYLE; |
|
||||||
|
|
||||||
public PreviewArea() { |
|
||||||
setPreferredSize(new Dimension(40, 30)); |
|
||||||
} |
|
||||||
|
|
||||||
public void preview(Style style) { |
|
||||||
this.style = style; |
|
||||||
repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void paintComponent(Graphics g) { |
|
||||||
Graphics2D g2d = (Graphics2D) g; |
|
||||||
int resolution = ScreenResolution.getScreenResolution(); |
|
||||||
|
|
||||||
if (style == Style.DEFAULT_STYLE) { |
|
||||||
// 如果是默认的style,就只写"Report"上去
|
|
||||||
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
Style.paintBackground(g2d, style, getWidth() - 3, getHeight() - 3); |
|
||||||
|
|
||||||
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution); |
|
||||||
|
|
||||||
Style.paintBorder(g2d, style, getWidth() - 3, getHeight() - 3); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public Dimension getMinimumSize() { |
|
||||||
return getPreferredSize(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,49 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.constants.LayoutConstants; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.gui.icontainer.UIScrollPane; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-17 |
|
||||||
*/ |
|
||||||
public abstract class AbstractChartStylePane extends BasicPane { |
|
||||||
|
|
||||||
public AbstractChartStylePane() { |
|
||||||
initComponents(); |
|
||||||
initPane(); |
|
||||||
} |
|
||||||
|
|
||||||
protected abstract void initComponents(); |
|
||||||
|
|
||||||
protected void initPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
double e = 155; |
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double[] columnSize = {p, e}; |
|
||||||
JPanel gapTableLayoutPane = TableLayoutHelper.createGapTableLayoutPane(getComponent(), getRows(p), columnSize, 20, LayoutConstants.VGAP_LARGE); |
|
||||||
gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
|
||||||
UIScrollPane rightTopPane = new UIScrollPane(gapTableLayoutPane); |
|
||||||
rightTopPane.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
this.add(rightTopPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
protected abstract Component[][] getComponent(); |
|
||||||
|
|
||||||
protected abstract double[] getRows(double p); |
|
||||||
|
|
||||||
public abstract void populate(PredefinedChartStyle chartStyle); |
|
||||||
|
|
||||||
public abstract void update(PredefinedChartStyle chartStyle); |
|
||||||
} |
|
@ -1,69 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.style.color.ColorSelectBox; |
|
||||||
|
|
||||||
import java.awt.Component; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-16 |
|
||||||
*/ |
|
||||||
public class ChartAxisStylePane extends AbstractChartStylePane { |
|
||||||
|
|
||||||
//轴标题字体样式
|
|
||||||
private ChartFontPane titleFontPane; |
|
||||||
|
|
||||||
//轴标签字体样式
|
|
||||||
private ChartFontPane labelFontPane; |
|
||||||
|
|
||||||
//轴线颜色
|
|
||||||
private ColorSelectBox axisLineColor; |
|
||||||
|
|
||||||
protected void initComponents() { |
|
||||||
titleFontPane = new ChartFontPane() { |
|
||||||
public String getUILabelText() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Chart_Axis_Title_Character"); |
|
||||||
} |
|
||||||
}; |
|
||||||
labelFontPane = new ChartFontPane() { |
|
||||||
public String getUILabelText() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Character"); |
|
||||||
} |
|
||||||
}; |
|
||||||
axisLineColor = new ColorSelectBox(100); |
|
||||||
} |
|
||||||
|
|
||||||
protected Component[][] getComponent() { |
|
||||||
return new Component[][]{ |
|
||||||
new Component[]{titleFontPane, null}, |
|
||||||
new Component[]{labelFontPane, null}, |
|
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Axis_Line_Color")), axisLineColor} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected double[] getRows(double p) { |
|
||||||
return new double[]{p, p, p}; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"); |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(PredefinedChartStyle chartStyle) { |
|
||||||
titleFontPane.populate(chartStyle.getAxisTitleFont()); |
|
||||||
labelFontPane.populate(chartStyle.getAxisLabelFont()); |
|
||||||
axisLineColor.setSelectObject(chartStyle.getAxisLineColor()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void update(PredefinedChartStyle chartStyle) { |
|
||||||
chartStyle.setAxisTitleFont(titleFontPane.update()); |
|
||||||
chartStyle.setAxisLabelFont(labelFontPane.update()); |
|
||||||
chartStyle.setAxisLineColor(axisLineColor.getSelectObject()); |
|
||||||
} |
|
||||||
} |
|
@ -1,113 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.base.background.ImageBackground; |
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; |
|
||||||
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; |
|
||||||
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; |
|
||||||
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; |
|
||||||
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; |
|
||||||
import com.fr.design.style.color.ColorSelectBox; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.stable.Constants; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
import java.awt.CardLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.event.ItemEvent; |
|
||||||
import java.awt.event.ItemListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-17 |
|
||||||
*/ |
|
||||||
public class ChartBackgroundStylePane extends AbstractChartStylePane { |
|
||||||
|
|
||||||
private UIComboBox typeComboBox; |
|
||||||
private List<BackgroundQuickPane> paneList; |
|
||||||
private JPanel centerPane; |
|
||||||
//网格线颜色
|
|
||||||
private ColorSelectBox mainGridColor; |
|
||||||
|
|
||||||
protected void initComponents() { |
|
||||||
mainGridColor = new ColorSelectBox(100); |
|
||||||
|
|
||||||
typeComboBox = new UIComboBox(); |
|
||||||
final CardLayout cardlayout = new CardLayout(); |
|
||||||
initList(); |
|
||||||
|
|
||||||
centerPane = new JPanel(cardlayout) { |
|
||||||
@Override |
|
||||||
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
|
|
||||||
int index = typeComboBox.getSelectedIndex(); |
|
||||||
return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height); |
|
||||||
} |
|
||||||
}; |
|
||||||
for (int i = 0; i < paneList.size(); i++) { |
|
||||||
BackgroundQuickPane pane = paneList.get(i); |
|
||||||
typeComboBox.addItem(pane.title4PopupWindow()); |
|
||||||
centerPane.add(pane, pane.title4PopupWindow()); |
|
||||||
} |
|
||||||
|
|
||||||
typeComboBox.addItemListener(new ItemListener() { |
|
||||||
@Override |
|
||||||
public void itemStateChanged(ItemEvent e) { |
|
||||||
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem()); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
protected Component[][] getComponent() { |
|
||||||
return new Component[][]{ |
|
||||||
new Component[]{null, null}, |
|
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Background_Color")), typeComboBox}, |
|
||||||
new Component[]{null, centerPane}, |
|
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Grid_Line_Color")), mainGridColor} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected double[] getRows(double p) { |
|
||||||
return new double[]{p, p, p, p}; |
|
||||||
} |
|
||||||
|
|
||||||
private void initList() { |
|
||||||
paneList = new ArrayList<>(); |
|
||||||
paneList.add(new NullBackgroundQuickPane()); |
|
||||||
paneList.add(new ColorBackgroundQuickPane()); |
|
||||||
paneList.add(new ImageBackgroundQuickPane(false)); |
|
||||||
paneList.add(new VanChartGradientPane()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"); |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(PredefinedChartStyle chartStyle) { |
|
||||||
Background background = chartStyle.getChartBackground(); |
|
||||||
for (int i = 0; i < paneList.size(); i++) { |
|
||||||
BackgroundQuickPane pane = paneList.get(i); |
|
||||||
if (pane.accept(background)) { |
|
||||||
pane.populateBean(background); |
|
||||||
typeComboBox.setSelectedIndex(i); |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
mainGridColor.setSelectObject(chartStyle.getGridMainLineColor()); |
|
||||||
} |
|
||||||
|
|
||||||
public void update(PredefinedChartStyle chartStyle) { |
|
||||||
chartStyle.setChartBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean()); |
|
||||||
if (chartStyle.getChartBackground() instanceof ImageBackground) { |
|
||||||
((ImageBackground) chartStyle.getChartBackground()).setLayout(Constants.IMAGE_EXTEND); |
|
||||||
} |
|
||||||
chartStyle.setGridMainLineColor(mainGridColor.getSelectObject()); |
|
||||||
} |
|
||||||
} |
|
@ -1,58 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.style.color.ColorSelectBox; |
|
||||||
|
|
||||||
import java.awt.Component; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-17 |
|
||||||
*/ |
|
||||||
public class ChartDataSheetStylePane extends AbstractChartStylePane { |
|
||||||
|
|
||||||
//字体样式
|
|
||||||
private ChartFontPane fontPane; |
|
||||||
|
|
||||||
//边框颜色
|
|
||||||
private ColorSelectBox borderColor; |
|
||||||
|
|
||||||
protected void initComponents() { |
|
||||||
fontPane = new ChartFontPane() { |
|
||||||
public String getUILabelText() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Chart_DataSheet_Character"); |
|
||||||
} |
|
||||||
}; |
|
||||||
borderColor = new ColorSelectBox(100); |
|
||||||
} |
|
||||||
|
|
||||||
protected Component[][] getComponent() { |
|
||||||
return new Component[][]{ |
|
||||||
new Component[]{fontPane, null}, |
|
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Border_Color")), borderColor} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected double[] getRows(double p) { |
|
||||||
return new double[]{p, p, p}; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Sheet"); |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(PredefinedChartStyle chartStyle) { |
|
||||||
fontPane.populate(chartStyle.getDataSheetFont()); |
|
||||||
borderColor.setSelectObject(chartStyle.getDataSheetBorderColor()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void update(PredefinedChartStyle chartStyle) { |
|
||||||
chartStyle.setDataSheetFont(fontPane.update()); |
|
||||||
chartStyle.setDataSheetBorderColor(borderColor.getSelectObject()); |
|
||||||
} |
|
||||||
} |
|
@ -1,160 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.base.FRContext; |
|
||||||
import com.fr.base.Utils; |
|
||||||
import com.fr.design.constants.LayoutConstants; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.gui.ibutton.UIColorButton; |
|
||||||
import com.fr.design.gui.ibutton.UIToggleButton; |
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
|
||||||
import com.fr.general.FRFont; |
|
||||||
import com.fr.general.GeneralUtils; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.SwingConstants; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.FlowLayout; |
|
||||||
import java.awt.Font; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-16 |
|
||||||
*/ |
|
||||||
public class ChartFontPane extends BasicPane { |
|
||||||
|
|
||||||
public static final int FONT_START = 6; |
|
||||||
public static final int FONT_END = 72; |
|
||||||
private UIComboBox fontNameComboBox; |
|
||||||
private UIComboBox fontSizeComboBox; |
|
||||||
private UIToggleButton bold; |
|
||||||
private UIToggleButton italic; |
|
||||||
private UIColorButton fontColor; |
|
||||||
private static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1]; |
|
||||||
|
|
||||||
static { |
|
||||||
for (int i = FONT_START; i <= FONT_END; i++) { |
|
||||||
FONT_SIZES[i - FONT_START] = i; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public ChartFontPane() { |
|
||||||
initState(); |
|
||||||
initComponents(); |
|
||||||
} |
|
||||||
|
|
||||||
private void initState() { |
|
||||||
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
|
||||||
fontSizeComboBox = new UIComboBox(FONT_SIZES); |
|
||||||
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
|
||||||
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
|
||||||
fontColor = new UIColorButton(); |
|
||||||
} |
|
||||||
|
|
||||||
protected void initComponents() { |
|
||||||
Component[] components = new Component[]{ |
|
||||||
fontColor, italic, bold |
|
||||||
}; |
|
||||||
JPanel buttonPane = new JPanel(new BorderLayout()); |
|
||||||
buttonPane.add(fontSizeComboBox, BorderLayout.CENTER); |
|
||||||
buttonPane.add(GUICoreUtils.createFlowPane(components, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); |
|
||||||
|
|
||||||
this.setLayout(new BorderLayout()); |
|
||||||
this.add(getContentPane(buttonPane), BorderLayout.CENTER); |
|
||||||
|
|
||||||
populate(FRContext.getDefaultValues().getFRFont()); |
|
||||||
} |
|
||||||
|
|
||||||
protected JPanel getContentPane(JPanel buttonPane) { |
|
||||||
double e = 155; |
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double[] rows = {p, p, p}; |
|
||||||
double[] columnSize = {p, e}; |
|
||||||
UILabel text = new UILabel(getUILabelText(), SwingConstants.LEFT); |
|
||||||
Component[][] components = { |
|
||||||
new Component[]{null, null}, |
|
||||||
new Component[]{text, fontNameComboBox}, |
|
||||||
new Component[]{null, buttonPane} |
|
||||||
}; |
|
||||||
|
|
||||||
return TableLayoutHelper.createGapTableLayoutPane(components, rows, columnSize, 20, LayoutConstants.VGAP_LARGE); |
|
||||||
} |
|
||||||
|
|
||||||
public String getUILabelText() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Chart_Character"); |
|
||||||
} |
|
||||||
|
|
||||||
public String title4PopupWindow() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(FRFont frFont) { |
|
||||||
UIObserverListener listener = fontNameComboBox == null ? null : fontNameComboBox.getUiObserverListener(); |
|
||||||
removeAllComboBoxListener(); |
|
||||||
|
|
||||||
if (frFont != null) { |
|
||||||
fontNameComboBox.setSelectedItem(frFont.getFamily()); |
|
||||||
bold.setSelected(frFont.isBold()); |
|
||||||
italic.setSelected(frFont.isItalic()); |
|
||||||
populateFontSize(frFont); |
|
||||||
if (fontColor != null) { |
|
||||||
fontColor.setColor(frFont.getForeground()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
//更新结束后,注册监听器
|
|
||||||
registerAllComboBoxListener(listener); |
|
||||||
} |
|
||||||
|
|
||||||
private void populateFontSize(FRFont frFont) { |
|
||||||
if (fontSizeComboBox != null) { |
|
||||||
fontSizeComboBox.setSelectedItem(frFont.getSize()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void removeAllComboBoxListener() { |
|
||||||
fontNameComboBox.removeChangeListener(); |
|
||||||
fontSizeComboBox.removeChangeListener(); |
|
||||||
} |
|
||||||
|
|
||||||
private void registerAllComboBoxListener(UIObserverListener listener) { |
|
||||||
fontNameComboBox.registerChangeListener(listener); |
|
||||||
fontSizeComboBox.registerChangeListener(listener); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 更新字 |
|
||||||
* |
|
||||||
* @return 更新字 |
|
||||||
*/ |
|
||||||
public FRFont update() { |
|
||||||
String name = GeneralUtils.objectToString(fontNameComboBox.getSelectedItem()); |
|
||||||
|
|
||||||
return FRFont.getInstance(name, updateFontStyle(), updateFontSize(), fontColor.getColor()); |
|
||||||
} |
|
||||||
|
|
||||||
private int updateFontStyle() { |
|
||||||
int style = Font.PLAIN; |
|
||||||
if (bold.isSelected() && !italic.isSelected()) { |
|
||||||
style = Font.BOLD; |
|
||||||
} else if (!bold.isSelected() && italic.isSelected()) { |
|
||||||
style = Font.ITALIC; |
|
||||||
} else if (bold.isSelected() && italic.isSelected()) { |
|
||||||
style = 3; |
|
||||||
} |
|
||||||
|
|
||||||
return style; |
|
||||||
} |
|
||||||
|
|
||||||
private float updateFontSize() { |
|
||||||
return Float.parseFloat(GeneralUtils.objectToString(fontSizeComboBox.getSelectedItem())); |
|
||||||
} |
|
||||||
} |
|
@ -1,78 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
|
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-16 |
|
||||||
*/ |
|
||||||
public class ChartLabelStylePane extends AbstractChartStylePane { |
|
||||||
|
|
||||||
private UIButtonGroup<Integer> autoButton; |
|
||||||
//字体样式
|
|
||||||
private ChartFontPane chartFontPane; |
|
||||||
|
|
||||||
protected void initComponents() { |
|
||||||
autoButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), |
|
||||||
Toolkit.i18nText("Fine-Design_Chart_Custom")}); |
|
||||||
chartFontPane = new ChartFontPane() { |
|
||||||
public String getUILabelText() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Chart_Label_Character"); |
|
||||||
} |
|
||||||
}; |
|
||||||
initListener(); |
|
||||||
} |
|
||||||
|
|
||||||
protected Component[][] getComponent() { |
|
||||||
return new Component[][]{ |
|
||||||
new Component[]{null, null}, |
|
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Setting")), autoButton}, |
|
||||||
new Component[]{chartFontPane, null} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected double[] getRows(double p) { |
|
||||||
return new double[]{p, p, p}; |
|
||||||
} |
|
||||||
|
|
||||||
private void initListener() { |
|
||||||
autoButton.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
checkPreButton(); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
private void checkPreButton() { |
|
||||||
chartFontPane.setVisible(autoButton.getSelectedIndex() == 1); |
|
||||||
chartFontPane.setPreferredSize(autoButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label"); |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(PredefinedChartStyle chartStyle) { |
|
||||||
autoButton.setSelectedIndex(chartStyle.isAutoLabelFont() ? 0 : 1); |
|
||||||
chartFontPane.populate(chartStyle.getLabelFont()); |
|
||||||
checkPreButton(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void update(PredefinedChartStyle chartStyle) { |
|
||||||
chartStyle.setAutoLabelFont(autoButton.getSelectedIndex() == 0); |
|
||||||
chartStyle.setLabelFont(chartFontPane.update()); |
|
||||||
} |
|
||||||
} |
|
@ -1,49 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
|
|
||||||
import java.awt.Component; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-16 |
|
||||||
*/ |
|
||||||
public class ChartLegendStylePane extends AbstractChartStylePane { |
|
||||||
|
|
||||||
//字体样式
|
|
||||||
private ChartFontPane chartFontPane; |
|
||||||
|
|
||||||
protected void initComponents() { |
|
||||||
chartFontPane = new ChartFontPane() { |
|
||||||
public String getUILabelText() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Chart_Legend_Character"); |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected Component[][] getComponent() { |
|
||||||
return new Component[][]{ |
|
||||||
new Component[]{chartFontPane, null} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected double[] getRows(double p) { |
|
||||||
return new double[]{p}; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend"); |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(PredefinedChartStyle chartStyle) { |
|
||||||
chartFontPane.populate(chartStyle.getLegendFont()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void update(PredefinedChartStyle chartStyle) { |
|
||||||
chartStyle.setLegendFont(chartFontPane.update()); |
|
||||||
} |
|
||||||
} |
|
@ -1,49 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.chart; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedChartStyle; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
|
|
||||||
import java.awt.Component; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-16 |
|
||||||
*/ |
|
||||||
public class ChartTitleStylePane extends AbstractChartStylePane { |
|
||||||
|
|
||||||
//字体样式
|
|
||||||
private ChartFontPane chartFontPane; |
|
||||||
|
|
||||||
protected void initComponents() { |
|
||||||
chartFontPane = new ChartFontPane() { |
|
||||||
public String getUILabelText() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Chart_Title_Character"); |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected Component[][] getComponent() { |
|
||||||
return new Component[][]{ |
|
||||||
new Component[]{chartFontPane, null} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected double[] getRows(double p) { |
|
||||||
return new double[]{p}; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return Toolkit.i18nText("Fine-Design_Report_Title"); |
|
||||||
} |
|
||||||
|
|
||||||
public void populate(PredefinedChartStyle chartStyle) { |
|
||||||
chartFontPane.populate(chartStyle.getTitleFont()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void update(PredefinedChartStyle chartStyle) { |
|
||||||
chartStyle.setTitleFont(chartFontPane.update()); |
|
||||||
} |
|
||||||
} |
|
@ -1,148 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.component; |
|
||||||
|
|
||||||
import com.fr.base.GraphHelper; |
|
||||||
import com.fr.base.Utils; |
|
||||||
import com.fr.config.predefined.PredefinedComponentStyle; |
|
||||||
import com.fr.design.gui.frpane.UINumberDragPane; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.gui.ibutton.UIButtonUI; |
|
||||||
import com.fr.design.gui.ibutton.UIColorButton; |
|
||||||
import com.fr.design.gui.icombobox.LineComboBox; |
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.gui.icontainer.UIScrollPane; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.gui.ispinner.UISpinner; |
|
||||||
import com.fr.design.gui.style.BackgroundSpecialPane; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; |
|
||||||
import com.fr.general.act.BorderPacker; |
|
||||||
import com.fr.stable.Constants; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JComponent; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.geom.RoundRectangle2D; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-01 |
|
||||||
*/ |
|
||||||
public class ComponentFrameStylePane extends ComponentStylePane { |
|
||||||
private final static String[] BORDER_STYLE = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Common"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow")}; |
|
||||||
private static final double ALPHA_MAX_NUMBER = 100; |
|
||||||
private final static int[] BORDER_LINE_STYLE_ARRAY = new int[]{ |
|
||||||
Constants.LINE_NONE, |
|
||||||
Constants.LINE_THIN, //1px
|
|
||||||
Constants.LINE_MEDIUM, //2px
|
|
||||||
Constants.LINE_THICK, //3px
|
|
||||||
}; |
|
||||||
|
|
||||||
//渲染风格
|
|
||||||
private UIComboBox borderStyleCombo; |
|
||||||
//边框粗细
|
|
||||||
private LineComboBox currentLineCombo; |
|
||||||
//边框圆角
|
|
||||||
private UISpinner borderCornerSpinner; |
|
||||||
//边框颜色
|
|
||||||
private UIColorButton currentLineColorPane; |
|
||||||
//主体背景
|
|
||||||
private BackgroundSpecialPane backgroundPane; |
|
||||||
//透明度
|
|
||||||
private UINumberDragPane numberDragPane; |
|
||||||
|
|
||||||
public ComponentFrameStylePane() { |
|
||||||
initPane(); |
|
||||||
} |
|
||||||
|
|
||||||
protected void initPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); |
|
||||||
this.borderStyleCombo = new UIComboBox(BORDER_STYLE); |
|
||||||
this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY); |
|
||||||
this.currentLineColorPane = new UIColorButton(null); |
|
||||||
this.borderCornerSpinner = new UISpinner(0, 1000, 1, 0); |
|
||||||
currentLineColorPane.setUI(getButtonUI(currentLineColorPane)); |
|
||||||
currentLineColorPane.set4ToolbarButton(); |
|
||||||
currentLineColorPane.setPreferredSize(new Dimension(20, 20)); |
|
||||||
JPanel buttonPane = new JPanel(new BorderLayout()); |
|
||||||
buttonPane.add(currentLineColorPane, BorderLayout.WEST); |
|
||||||
backgroundPane = new BackgroundSpecialPane(); |
|
||||||
JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
this.numberDragPane = new UINumberDragPane(0, 100); |
|
||||||
transparencyPane.add(numberDragPane, BorderLayout.CENTER); |
|
||||||
transparencyPane.add(new UILabel(" %"), BorderLayout.EAST); |
|
||||||
|
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double[] rowSize = {p, p, p, p, p, p, p, p}; |
|
||||||
double[] columnSize = {p, 157}; |
|
||||||
JPanel rightTopContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo}, |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Line")), currentLineCombo}, |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Color")), buttonPane}, |
|
||||||
getBorderCornerSpinnerComp(), |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Background")), backgroundPane}, |
|
||||||
{new UILabel(""), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))}, |
|
||||||
{new UILabel(""), transparencyPane}, |
|
||||||
}, rowSize, columnSize, 10); |
|
||||||
UIScrollPane rightTopPane = new UIScrollPane(rightTopContentPane); |
|
||||||
rightTopPane.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
this.add(rightTopPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private JComponent[] getBorderCornerSpinnerComp() { |
|
||||||
return new JComponent[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius") + ":"), borderCornerSpinner}; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
protected UIButtonUI getButtonUI(final UIColorButton uiColorButton) { |
|
||||||
return new UIButtonUI() { |
|
||||||
|
|
||||||
public void paint(Graphics g, JComponent c) { |
|
||||||
UIButton b = (UIButton) c; |
|
||||||
g.setColor(Color.black); |
|
||||||
GraphHelper.draw(g, new RoundRectangle2D.Double(1, 1, b.getWidth() - 2, b.getHeight() - 2, 0, 0), 1); |
|
||||||
|
|
||||||
if (b.getModel().isEnabled()) { |
|
||||||
g.setColor(uiColorButton.getColor()); |
|
||||||
} else { |
|
||||||
g.setColor(new Color(Utils.filterRGB(uiColorButton.getColor().getRGB(), 50))); |
|
||||||
} |
|
||||||
g.fillRect(2, 2, b.getWidth() - 3, b.getHeight() - 3); |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(PredefinedComponentStyle componentStyle) { |
|
||||||
BorderPacker borderStyle = componentStyle.getBorderStyle(); |
|
||||||
this.borderStyleCombo.setSelectedIndex(borderStyle.getBorderStyle()); |
|
||||||
this.borderCornerSpinner.setValue(borderStyle.getBorderRadius()); |
|
||||||
this.currentLineCombo.setSelectedLineStyle(borderStyle.getBorder()); |
|
||||||
this.currentLineColorPane.setColor(borderStyle.getColor()); |
|
||||||
this.backgroundPane.populateBean(borderStyle.getBackground()); |
|
||||||
numberDragPane.populateBean(borderStyle.getAlpha() * ALPHA_MAX_NUMBER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void update(PredefinedComponentStyle componentStyle) { |
|
||||||
BorderPacker style = componentStyle.getBorderStyle(); |
|
||||||
style.setBorderStyle(borderStyleCombo.getSelectedIndex()); |
|
||||||
style.setBorderRadius((int) borderCornerSpinner.getValue()); |
|
||||||
style.setBorder(currentLineCombo.getSelectedLineStyle()); |
|
||||||
style.setColor(currentLineColorPane.getColor()); |
|
||||||
style.setBackground(backgroundPane.update()); |
|
||||||
style.setAlpha((float) (numberDragPane.updateBean() / ALPHA_MAX_NUMBER)); |
|
||||||
} |
|
||||||
} |
|
@ -1,93 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.component; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedComponentStyle; |
|
||||||
import com.fr.design.designer.IntervalConstants; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.gui.ispinner.UISpinner; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.SwingConstants; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-01 |
|
||||||
*/ |
|
||||||
public class ComponentMarginStylePane extends ComponentStylePane { |
|
||||||
protected UISpinner top; |
|
||||||
protected UISpinner bottom; |
|
||||||
protected UISpinner left; |
|
||||||
protected UISpinner right; |
|
||||||
|
|
||||||
public ComponentMarginStylePane() { |
|
||||||
initBoundPane(0, 0, 0, 0); |
|
||||||
} |
|
||||||
|
|
||||||
public void initBoundPane(int t, int b, int l, int r) { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
top = new UISpinner(0, Integer.MAX_VALUE, 1, t); |
|
||||||
bottom = new UISpinner(0, Integer.MAX_VALUE, 1, b); |
|
||||||
left = new UISpinner(0, Integer.MAX_VALUE, 1, l); |
|
||||||
right = new UISpinner(0, Integer.MAX_VALUE, 1, r); |
|
||||||
top.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate")); |
|
||||||
bottom.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate")); |
|
||||||
left.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate")); |
|
||||||
right.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate")); |
|
||||||
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate")); |
|
||||||
label.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); |
|
||||||
label.setVerticalAlignment(SwingConstants.TOP); |
|
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ |
|
||||||
new Component[]{label, createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); |
|
||||||
this.add(panel); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public JPanel createRightPane() { |
|
||||||
double f = TableLayout.FILL; |
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double[] rowSize = {p, p}; |
|
||||||
double[] columnSize = {f, f}; |
|
||||||
int[][] rowCount = {{1, 1}, {1, 1}}; |
|
||||||
Component[][] components1 = new Component[][]{ |
|
||||||
new Component[]{top, bottom}, |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Top"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bottom"), SwingConstants.CENTER)} |
|
||||||
}; |
|
||||||
Component[][] components2 = new Component[][]{ |
|
||||||
new Component[]{left, right}, |
|
||||||
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Left"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Right"), SwingConstants.CENTER)} |
|
||||||
}; |
|
||||||
JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L6); |
|
||||||
northPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0)); |
|
||||||
JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(components2, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L6); |
|
||||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); |
|
||||||
panel.add(northPanel, BorderLayout.NORTH); |
|
||||||
panel.add(centerPanel, BorderLayout.CENTER); |
|
||||||
return panel; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Margin"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(PredefinedComponentStyle componentStyle) { |
|
||||||
this.top.setValue(componentStyle.getTop()); |
|
||||||
this.bottom.setValue(componentStyle.getBottom()); |
|
||||||
this.left.setValue(componentStyle.getLeft()); |
|
||||||
this.right.setValue(componentStyle.getRight()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void update(PredefinedComponentStyle componentStyle) { |
|
||||||
componentStyle.setTop((int) this.top.getValue()); |
|
||||||
componentStyle.setBottom((int) this.bottom.getValue()); |
|
||||||
componentStyle.setLeft((int) this.left.getValue()); |
|
||||||
componentStyle.setRight((int) this.right.getValue()); |
|
||||||
} |
|
||||||
} |
|
@ -1,15 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.component; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedComponentStyle; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-01 |
|
||||||
*/ |
|
||||||
public abstract class ComponentStylePane extends BasicPane { |
|
||||||
|
|
||||||
public abstract void populate(PredefinedComponentStyle componentStyle); |
|
||||||
|
|
||||||
public abstract void update(PredefinedComponentStyle componentStyle); |
|
||||||
} |
|
@ -1,253 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.detail.component; |
|
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
|
||||||
import com.fr.base.Utils; |
|
||||||
import com.fr.config.predefined.PredefinedComponentStyle; |
|
||||||
import com.fr.design.constants.LayoutConstants; |
|
||||||
import com.fr.design.constants.UIConstants; |
|
||||||
import com.fr.design.formula.TinyFormulaPane; |
|
||||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
||||||
import com.fr.design.gui.ibutton.UIColorButton; |
|
||||||
import com.fr.design.gui.ibutton.UIToggleButton; |
|
||||||
import com.fr.design.gui.icombobox.LineComboBox; |
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.gui.icontainer.UIScrollPane; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.gui.style.BackgroundNoImagePane; |
|
||||||
import com.fr.design.gui.style.FRFontPane; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; |
|
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
|
||||||
import com.fr.form.ui.LayoutBorderStyle; |
|
||||||
import com.fr.form.ui.WidgetTitle; |
|
||||||
import com.fr.general.FRFont; |
|
||||||
import com.fr.general.act.BorderPacker; |
|
||||||
import com.fr.general.act.TitlePacker; |
|
||||||
import com.fr.stable.ArrayUtils; |
|
||||||
import com.fr.stable.Constants; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.Icon; |
|
||||||
import javax.swing.JComponent; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.FlowLayout; |
|
||||||
import java.awt.Font; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-01 |
|
||||||
*/ |
|
||||||
public class ComponentTitleStylePane extends ComponentStylePane { |
|
||||||
private final static Dimension BUTTON_SIZE = new Dimension(24, 20); |
|
||||||
//标题内容
|
|
||||||
private TinyFormulaPane formulaPane; |
|
||||||
//标题格式
|
|
||||||
private UIComboBox fontNameComboBox; |
|
||||||
private UIComboBox fontSizeComboBox; |
|
||||||
private UIColorButton colorSelectPane; |
|
||||||
private UIToggleButton bold; |
|
||||||
private UIToggleButton italic; |
|
||||||
private UIToggleButton underline; |
|
||||||
private LineComboBox underlineCombo; |
|
||||||
//对齐方式
|
|
||||||
private UIButtonGroup hAlignmentPane; |
|
||||||
//标题背景
|
|
||||||
private BackgroundNoImagePane titleBackgroundPane; |
|
||||||
|
|
||||||
public static ComponentTitleStylePane createPredefinedSettingPane(){ |
|
||||||
return new ComponentTitleStylePane(true); |
|
||||||
} |
|
||||||
|
|
||||||
public static ComponentTitleStylePane createStyleSettingPane(){ |
|
||||||
return new ComponentTitleStylePane(false); |
|
||||||
} |
|
||||||
|
|
||||||
private ComponentTitleStylePane(boolean isPredefined) { |
|
||||||
initPane(isPredefined); |
|
||||||
} |
|
||||||
|
|
||||||
protected void initPane(boolean isPredefined) { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setBorder(BorderFactory.createEmptyBorder(6, 0,0,0)); |
|
||||||
formulaPane = new TinyFormulaPane(); |
|
||||||
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); |
|
||||||
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
|
||||||
fontNameComboBox.setPreferredSize(new Dimension(105 , 20)); |
|
||||||
JPanel fontSizeTypePane = new JPanel(new BorderLayout(3, 0)); |
|
||||||
fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); |
|
||||||
fontSizeTypePane.add(fontNameComboBox, BorderLayout.EAST); |
|
||||||
|
|
||||||
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
|
||||||
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
|
||||||
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; |
|
||||||
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
|
||||||
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); |
|
||||||
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") |
|
||||||
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), |
|
||||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")}); |
|
||||||
JPanel hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
|
||||||
hPaneContainer.add(hAlignmentPane); |
|
||||||
|
|
||||||
titleBackgroundPane = new BackgroundNoImagePane(); |
|
||||||
|
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double[] rowSize = {p, p, p, p, p, p, p, p}; |
|
||||||
double[] columnSize = {p, 157}; |
|
||||||
JComponent[][] jComponents = new JComponent[][]{ |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Char"))), fontSizeTypePane}, |
|
||||||
{new UILabel(""), initFontButtonPane()}, |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Alignment-Style")), hAlignmentPane}, |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Background")), titleBackgroundPane}}; |
|
||||||
|
|
||||||
JComponent[][] displayComponents = createDisplayComponentArray(isPredefined, jComponents); |
|
||||||
JPanel rightBottomContentPane = TableLayoutHelper.createCommonTableLayoutPane(displayComponents, rowSize, columnSize, 10); |
|
||||||
|
|
||||||
UIScrollPane jPanel = new UIScrollPane(rightBottomContentPane); |
|
||||||
jPanel.setBorder(BorderFactory.createEmptyBorder()); |
|
||||||
this.add(jPanel, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
private JComponent[][] createDisplayComponentArray(boolean isPredefined, JComponent[][] baseComponents) { |
|
||||||
if (isPredefined) { |
|
||||||
return baseComponents; |
|
||||||
} |
|
||||||
JComponent[][] titleComponent = new JComponent[][]{{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content")), formulaPane}}; |
|
||||||
return ArrayUtils.addAll(titleComponent, baseComponents); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
protected JPanel initFontButtonPane() { |
|
||||||
colorSelectPane = new UIColorButton(); |
|
||||||
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
|
||||||
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
|
||||||
underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); |
|
||||||
bold.setPreferredSize(BUTTON_SIZE); |
|
||||||
italic.setPreferredSize(BUTTON_SIZE); |
|
||||||
underline.setPreferredSize(BUTTON_SIZE); |
|
||||||
underline.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
underlineCombo.setVisible(underline.isSelected()); |
|
||||||
} |
|
||||||
}); |
|
||||||
underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY); |
|
||||||
Component[] components_font = new Component[]{ |
|
||||||
colorSelectPane, italic, bold, underline |
|
||||||
}; |
|
||||||
JPanel buttonPane = new JPanel(new BorderLayout()); |
|
||||||
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL)); |
|
||||||
JPanel combinePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
combinePane.add(buttonPane, BorderLayout.WEST); |
|
||||||
combinePane.add(underlineCombo, BorderLayout.CENTER); |
|
||||||
initAllNames(); |
|
||||||
setToolTips(); |
|
||||||
return combinePane; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
protected void initAllNames() { |
|
||||||
fontNameComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Family")); |
|
||||||
fontSizeComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Size")); |
|
||||||
colorSelectPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Foreground")); |
|
||||||
italic.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Italic")); |
|
||||||
bold.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Bold")); |
|
||||||
underline.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); |
|
||||||
underlineCombo.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style")); |
|
||||||
} |
|
||||||
|
|
||||||
protected void setToolTips() { |
|
||||||
colorSelectPane.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Foreground")); |
|
||||||
italic.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Italic")); |
|
||||||
bold.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Bold")); |
|
||||||
underline.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Title"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(PredefinedComponentStyle componentStyle) { |
|
||||||
BorderPacker borderStyle = componentStyle.getBorderStyle(); |
|
||||||
TitlePacker widgetTitle = borderStyle == null ? new WidgetTitle() : borderStyle.getTitle(); |
|
||||||
widgetTitle = widgetTitle == null ? new WidgetTitle() : widgetTitle; |
|
||||||
|
|
||||||
populateFormula(widgetTitle); |
|
||||||
populateFont(widgetTitle); |
|
||||||
|
|
||||||
hAlignmentPane.setSelectedItem(widgetTitle.getPosition()); |
|
||||||
|
|
||||||
titleBackgroundPane.populateBean(widgetTitle.getBackground()); |
|
||||||
} |
|
||||||
|
|
||||||
private void populateFormula(TitlePacker widgetTitle) { |
|
||||||
this.formulaPane.populateBean(widgetTitle.getTextObject().toString()); |
|
||||||
} |
|
||||||
|
|
||||||
protected void populateFont(TitlePacker widgetTitle) { |
|
||||||
FRFont frFont = widgetTitle.getFrFont(); |
|
||||||
this.fontSizeComboBox.setSelectedItem(frFont.getSize()); |
|
||||||
this.fontNameComboBox.setSelectedItem(frFont.getFamily()); |
|
||||||
this.colorSelectPane.setColor(frFont.getForeground()); |
|
||||||
this.colorSelectPane.repaint(); |
|
||||||
bold.setSelected(frFont.isBold()); |
|
||||||
italic.setSelected(frFont.isItalic()); |
|
||||||
int line = frFont.getUnderline(); |
|
||||||
if (line == Constants.LINE_NONE) { |
|
||||||
underline.setSelected(false); |
|
||||||
underlineCombo.setVisible(false); |
|
||||||
} else { |
|
||||||
underline.setSelected(true); |
|
||||||
underlineCombo.setVisible(true); |
|
||||||
this.underlineCombo.setSelectedLineStyle(line); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void update(PredefinedComponentStyle componentStyle) { |
|
||||||
BorderPacker style = componentStyle.getBorderStyle(); |
|
||||||
TitlePacker title = style.getTitle() == null ? new WidgetTitle() : style.getTitle(); |
|
||||||
String titleText = formulaPane.updateBean(); |
|
||||||
title.setTextObject(titleText); |
|
||||||
style.setType(StringUtils.isEmpty(titleText) ? LayoutBorderStyle.STANDARD : LayoutBorderStyle.TITLE); |
|
||||||
FRFont frFont = title.getFrFont(); |
|
||||||
frFont = frFont.applySize((Integer) fontSizeComboBox.getSelectedItem()); |
|
||||||
frFont = frFont.applyName(fontNameComboBox.getSelectedItem().toString()); |
|
||||||
frFont = frFont.applyForeground(colorSelectPane.getColor()); |
|
||||||
frFont = updateItalicBold(frFont); |
|
||||||
int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE; |
|
||||||
frFont = frFont.applyUnderline(line); |
|
||||||
title.setFrFont(frFont); |
|
||||||
title.setPosition((Integer) hAlignmentPane.getSelectedItem()); |
|
||||||
title.setBackground(titleBackgroundPane.update()); |
|
||||||
style.setTitle(title); |
|
||||||
} |
|
||||||
|
|
||||||
private FRFont updateItalicBold(FRFont frFont) { |
|
||||||
int italic_bold = frFont.getStyle(); |
|
||||||
boolean isItalic = italic_bold == Font.ITALIC || italic_bold == (Font.BOLD + Font.ITALIC); |
|
||||||
boolean isBold = italic_bold == Font.BOLD || italic_bold == (Font.BOLD + Font.ITALIC); |
|
||||||
if (italic.isSelected() && !isItalic) { |
|
||||||
italic_bold += Font.ITALIC; |
|
||||||
} else if (!italic.isSelected() && isItalic) { |
|
||||||
italic_bold -= Font.ITALIC; |
|
||||||
} |
|
||||||
frFont = frFont.applyStyle(italic_bold); |
|
||||||
if (bold.isSelected() && !isBold) { |
|
||||||
italic_bold += Font.BOLD; |
|
||||||
} else if (!bold.isSelected() && isBold) { |
|
||||||
italic_bold -= Font.BOLD; |
|
||||||
} |
|
||||||
frFont = frFont.applyStyle(italic_bold); |
|
||||||
return frFont; |
|
||||||
} |
|
||||||
} |
|
@ -1,193 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.dialog; |
|
||||||
|
|
||||||
import com.fr.config.ServerPreferenceConfig; |
|
||||||
import com.fr.config.predefined.PredefinedStyleConfig; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.gui.itextfield.UITextField; |
|
||||||
import com.fr.design.mainframe.predefined.ui.PredefinedStyleEditPane; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JDialog; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.DocumentEvent; |
|
||||||
import javax.swing.event.DocumentListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Window; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
import java.awt.event.WindowAdapter; |
|
||||||
import java.awt.event.WindowEvent; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-26 |
|
||||||
*/ |
|
||||||
public class PredefinedStyleEditDialog extends JDialog { |
|
||||||
|
|
||||||
public PredefinedStyleEditDialog(Window parent, PredefinedStyleEditPane contentPane) { |
|
||||||
this(parent, contentPane, false); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public PredefinedStyleEditDialog(Window parent, PredefinedStyleEditPane contentPane, boolean isBuiltIn) { |
|
||||||
super(parent, ModalityType.APPLICATION_MODAL); |
|
||||||
|
|
||||||
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Edit")); |
|
||||||
this.setResizable(false); |
|
||||||
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
||||||
this.setContentPane(defaultPane); |
|
||||||
|
|
||||||
UIButton saveBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save")); |
|
||||||
saveBtn.setEnabled(!isBuiltIn); |
|
||||||
saveBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
if(contentPane.saveStyle()){ |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
UIButton saveAsBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Save_As_New")); |
|
||||||
saveAsBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
SaveAsNewStyleDialog saveAsNewStyleDialog = new SaveAsNewStyleDialog(PredefinedStyleEditDialog.this, contentPane); |
|
||||||
saveAsNewStyleDialog.setVisible(true); |
|
||||||
|
|
||||||
} |
|
||||||
}); |
|
||||||
UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); |
|
||||||
cancelBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
||||||
buttonPanel.add(saveBtn); |
|
||||||
buttonPanel.add(saveAsBtn); |
|
||||||
buttonPanel.add(cancelBtn); |
|
||||||
|
|
||||||
defaultPane.add(contentPane, BorderLayout.CENTER); |
|
||||||
defaultPane.add(buttonPanel, BorderLayout.SOUTH); |
|
||||||
|
|
||||||
addWindowListener(new WindowAdapter() { |
|
||||||
public void windowClosing(WindowEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
this.setSize(new Dimension(900, 600)); |
|
||||||
GUICoreUtils.centerWindow(this); |
|
||||||
} |
|
||||||
|
|
||||||
public void dialogExit() { |
|
||||||
this.dispose(); |
|
||||||
} |
|
||||||
|
|
||||||
class SaveAsNewStyleDialog extends JDialog { |
|
||||||
private UITextField textField; |
|
||||||
private UILabel tipLabel; |
|
||||||
|
|
||||||
public SaveAsNewStyleDialog(Window parent, PredefinedStyleEditPane editPane) { |
|
||||||
super(parent, ModalityType.APPLICATION_MODAL); |
|
||||||
|
|
||||||
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Save_As_New")); |
|
||||||
this.setResizable(false); |
|
||||||
UIButton confirm = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm")); |
|
||||||
confirm.setEnabled(false); |
|
||||||
confirm.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
String name = textField.getText(); |
|
||||||
if (valid(name)) { |
|
||||||
editPane.saveAsNewStyle(name); |
|
||||||
dialogExit(); |
|
||||||
PredefinedStyleEditDialog.this.dialogExit(); |
|
||||||
} else { |
|
||||||
tipLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Name_Repeat")); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
UIButton cancle = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); |
|
||||||
cancle.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
||||||
JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
||||||
buttonPanel.add(confirm); |
|
||||||
buttonPanel.add(cancle); |
|
||||||
|
|
||||||
JPanel panel = createSaveAsPane(confirm); |
|
||||||
|
|
||||||
|
|
||||||
defaultPane.add(panel, BorderLayout.CENTER); |
|
||||||
defaultPane.add(buttonPanel, BorderLayout.SOUTH); |
|
||||||
|
|
||||||
this.setContentPane(defaultPane); |
|
||||||
|
|
||||||
addWindowListener(new WindowAdapter() { |
|
||||||
public void windowClosing(WindowEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
this.setSize(new Dimension(300, 140)); |
|
||||||
GUICoreUtils.centerWindow(this); |
|
||||||
} |
|
||||||
|
|
||||||
private JPanel createSaveAsPane(UIButton confirm) { |
|
||||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel centerPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(20, 5); |
|
||||||
centerPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Name"))); |
|
||||||
textField = new UITextField(); |
|
||||||
textField.getDocument().addDocumentListener(new DocumentListener() { |
|
||||||
@Override |
|
||||||
public void insertUpdate(DocumentEvent e) { |
|
||||||
confirm.setEnabled(StringUtils.isNotEmpty(textField.getText())); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void removeUpdate(DocumentEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void changedUpdate(DocumentEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
}); |
|
||||||
textField.setPreferredSize(new Dimension(180, 20)); |
|
||||||
centerPane.add(textField); |
|
||||||
panel.add(centerPane, BorderLayout.CENTER); |
|
||||||
tipLabel = new UILabel(); |
|
||||||
tipLabel.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0)); |
|
||||||
tipLabel.setForeground(Color.RED); |
|
||||||
panel.add(tipLabel, BorderLayout.SOUTH); |
|
||||||
return panel; |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void dialogExit() { |
|
||||||
this.dispose(); |
|
||||||
} |
|
||||||
|
|
||||||
private boolean valid(String name) { |
|
||||||
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); |
|
||||||
return !config.containStyle(name); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,97 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.dialog; |
|
||||||
|
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.ReportPredefinedStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.ServerPredefinedStylePane; |
|
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
|
||||||
import com.fr.workspace.WorkContext; |
|
||||||
|
|
||||||
import javax.swing.JDialog; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Window; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
import java.awt.event.WindowAdapter; |
|
||||||
import java.awt.event.WindowEvent; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-26 |
|
||||||
*/ |
|
||||||
public class ReportPredefinedStyleDialog extends JDialog { |
|
||||||
|
|
||||||
|
|
||||||
public ReportPredefinedStyleDialog(Window parent, ReportPredefinedStylePane contentPane) { |
|
||||||
super(parent, ModalityType.APPLICATION_MODAL); |
|
||||||
|
|
||||||
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Template_Style")); |
|
||||||
this.setResizable(false); |
|
||||||
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
||||||
this.setContentPane(defaultPane); |
|
||||||
UIButton managerBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Style_Manager")); |
|
||||||
managerBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
ServerPredefinedStylePane predefinedStylePane = new ServerPredefinedStylePane(); |
|
||||||
ServerPredefinedStyleDialog dialog = new ServerPredefinedStyleDialog(ReportPredefinedStyleDialog.this, predefinedStylePane); |
|
||||||
dialog.setVisible(true); |
|
||||||
dialog.addWindowListener(new WindowAdapter() { |
|
||||||
@Override |
|
||||||
public void windowClosed(WindowEvent e) { |
|
||||||
contentPane.refresh(); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
UIButton settingBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Applicate_Style")); |
|
||||||
settingBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
contentPane.update(); |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); |
|
||||||
cancelBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
|
|
||||||
if (WorkContext.getCurrent().isRoot()){ |
|
||||||
JPanel buttonPanel1 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
||||||
buttonPanel1.add(managerBtn); |
|
||||||
southPane.add(buttonPanel1, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
JPanel buttonPanel2 = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
||||||
buttonPanel2.add(settingBtn); |
|
||||||
buttonPanel2.add(cancelBtn); |
|
||||||
|
|
||||||
southPane.add(buttonPanel2, BorderLayout.EAST); |
|
||||||
|
|
||||||
defaultPane.add(contentPane, BorderLayout.CENTER); |
|
||||||
defaultPane.add(southPane, BorderLayout.SOUTH); |
|
||||||
|
|
||||||
addWindowListener(new WindowAdapter() { |
|
||||||
public void windowClosing(WindowEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
this.setSize(new Dimension(660, 600)); |
|
||||||
GUICoreUtils.centerWindow(this); |
|
||||||
} |
|
||||||
|
|
||||||
public void dialogExit() { |
|
||||||
this.dispose(); |
|
||||||
} |
|
||||||
} |
|
@ -1,68 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.dialog; |
|
||||||
|
|
||||||
import com.fr.design.mainframe.predefined.ui.ServerPredefinedStylePane; |
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
|
||||||
|
|
||||||
import javax.swing.JDialog; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Window; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.awt.event.ActionListener; |
|
||||||
import java.awt.event.WindowAdapter; |
|
||||||
import java.awt.event.WindowEvent; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-26 |
|
||||||
*/ |
|
||||||
public class ServerPredefinedStyleDialog extends JDialog { |
|
||||||
|
|
||||||
|
|
||||||
public ServerPredefinedStyleDialog(Window parent, ServerPredefinedStylePane contentPane) { |
|
||||||
super(parent, ModalityType.APPLICATION_MODAL); |
|
||||||
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Server_Style")); |
|
||||||
this.setResizable(false); |
|
||||||
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
||||||
this.setContentPane(defaultPane); |
|
||||||
|
|
||||||
UIButton settingBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Set_Default")); |
|
||||||
settingBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
contentPane.update(); |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
UIButton cancelBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); |
|
||||||
cancelBtn.addActionListener(new ActionListener() { |
|
||||||
@Override |
|
||||||
public void actionPerformed(ActionEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
||||||
buttonPanel.add(settingBtn); |
|
||||||
buttonPanel.add(cancelBtn); |
|
||||||
|
|
||||||
defaultPane.add(contentPane, BorderLayout.CENTER); |
|
||||||
defaultPane.add(buttonPanel, BorderLayout.SOUTH); |
|
||||||
|
|
||||||
addWindowListener(new WindowAdapter() { |
|
||||||
public void windowClosing(WindowEvent e) { |
|
||||||
dialogExit(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
this.setSize(new Dimension(660, 600)); |
|
||||||
GUICoreUtils.centerWindow(this); |
|
||||||
} |
|
||||||
|
|
||||||
public void dialogExit(){ |
|
||||||
this.dispose(); |
|
||||||
} |
|
||||||
} |
|
@ -1,108 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.preview; |
|
||||||
|
|
||||||
import com.fr.base.chart.BaseChartCollection; |
|
||||||
import com.fr.base.chart.BaseChartPainter; |
|
||||||
import com.fr.base.chart.chartdata.CallbackEvent; |
|
||||||
import com.fr.base.chart.result.WebChartIDInfo; |
|
||||||
import com.fr.chart.chartattr.ChartCollection; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.design.gui.chart.MiddleChartComponent; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.script.Calculator; |
|
||||||
import com.fr.stable.core.PropertyChangeListener; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.Graphics2D; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2020-09-28 |
|
||||||
*/ |
|
||||||
public class ChartPreStylePreView extends MiddleChartComponent { |
|
||||||
|
|
||||||
private ChartCollection chartCollection; |
|
||||||
|
|
||||||
private double scaleX = 1.0; |
|
||||||
private double scaleY = 1.0; |
|
||||||
|
|
||||||
private CallbackEvent callbackEvent; |
|
||||||
|
|
||||||
private static final int BOUNDS = 10; |
|
||||||
|
|
||||||
private Background componentBackground; |
|
||||||
|
|
||||||
public ChartPreStylePreView() { |
|
||||||
} |
|
||||||
|
|
||||||
public ChartPreStylePreView(ChartCollection cc) { |
|
||||||
this(cc, 1.0, 1.0); |
|
||||||
} |
|
||||||
|
|
||||||
public ChartPreStylePreView(ChartCollection cc, double scaleX, double scaleY) { |
|
||||||
this.scaleX = scaleX; |
|
||||||
this.scaleY = scaleY; |
|
||||||
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); |
|
||||||
populate(cc); |
|
||||||
} |
|
||||||
|
|
||||||
public void setCallbackEvent(CallbackEvent callbackEvent) { |
|
||||||
this.callbackEvent = callbackEvent; |
|
||||||
} |
|
||||||
|
|
||||||
public void paintComponent(Graphics g) { |
|
||||||
Graphics2D g2d = (Graphics2D) g; |
|
||||||
g2d.translate(BOUNDS, BOUNDS); |
|
||||||
g2d.scale(scaleX, scaleY); |
|
||||||
super.paintComponent(g); |
|
||||||
drawChart(g2d); |
|
||||||
g2d.scale(1 / scaleX, 1 / scaleY); |
|
||||||
g2d.translate(-BOUNDS, -BOUNDS); |
|
||||||
} |
|
||||||
|
|
||||||
private void drawChart(Graphics2D g2d) { |
|
||||||
Dimension d = getBounds().getSize(); |
|
||||||
int chartWidth = (int) (d.width / scaleX) - BOUNDS * 2; |
|
||||||
int chartHeight = (int) (d.height / scaleX) - BOUNDS * 2; |
|
||||||
if (componentBackground != null) { |
|
||||||
Graphics clipg = g2d.create(0, 0, chartWidth, chartHeight); |
|
||||||
componentBackground.paint(clipg, clipg.getClipBounds()); |
|
||||||
} |
|
||||||
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), |
|
||||||
WebChartIDInfo.createEmptyDesignerInfo(), chartWidth, chartHeight); |
|
||||||
painter.paint(g2d, chartWidth, chartHeight, 0, null, callbackEvent); |
|
||||||
} |
|
||||||
|
|
||||||
public void refresh(PredefinedStyle style) { |
|
||||||
/*VanChart vanChart = chartCollection.getSelectedChartProvider(VanChart.class); |
|
||||||
List<ChartThemeStyleProvider> chartThemeStyleProviders = vanChart.getChartPreStyleProvider(); |
|
||||||
for (ChartThemeStyleProvider chartThemeStyleProvider : chartThemeStyleProviders) { |
|
||||||
chartThemeStyleProvider.updateThemeStyle(style); |
|
||||||
} |
|
||||||
componentBackground = style.getComponentStyle().getBorderStyle().getBackground(); |
|
||||||
vanChart.attrChange();*/ |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(BaseChartCollection cc) { |
|
||||||
this.chartCollection = (ChartCollection) cc; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public BaseChartCollection update() { |
|
||||||
return this.chartCollection; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void addStopEditingListener(PropertyChangeListener l) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void reset() { |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,142 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.preview; |
|
||||||
|
|
||||||
import com.fr.base.FRContext; |
|
||||||
import com.fr.base.GraphHelper; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.general.FRFont; |
|
||||||
import com.fr.general.act.BorderPacker; |
|
||||||
import com.fr.general.act.TitlePacker; |
|
||||||
import com.fr.stable.Constants; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.FontMetrics; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.awt.geom.Rectangle2D; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-04 |
|
||||||
*/ |
|
||||||
public abstract class ComponentPreviewPane extends StyleSettingPreviewPane { |
|
||||||
private PredefinedStyle style = new PredefinedStyle(); |
|
||||||
private static final int SMALL_GAP = 10; |
|
||||||
private static final int GAP = 10; |
|
||||||
private JPanel contentPane; |
|
||||||
private TitlePreviewPane titlePane; |
|
||||||
|
|
||||||
|
|
||||||
public ComponentPreviewPane() { |
|
||||||
this.setBackground(null); |
|
||||||
this.setOpaque(false); |
|
||||||
this.contentPane = createContentPane(); |
|
||||||
this.titlePane = new TitlePreviewPane(); |
|
||||||
this.titlePane.setPreferredSize(new Dimension(484, 35)); |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); |
|
||||||
|
|
||||||
this.add(titlePane, BorderLayout.NORTH); |
|
||||||
this.add(contentPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
protected abstract JPanel createContentPane(); |
|
||||||
|
|
||||||
public void refresh() { |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
public void refresh(PredefinedStyle style) { |
|
||||||
this.style = style; |
|
||||||
} |
|
||||||
|
|
||||||
public void paintComponents(Graphics g) { |
|
||||||
BorderPacker borderStyle = style.getComponentStyle().getBorderStyle(); |
|
||||||
|
|
||||||
updateBorders(g, borderStyle); |
|
||||||
|
|
||||||
paintTitle(g, borderStyle.getTitle()); |
|
||||||
|
|
||||||
paintContentPane(g, borderStyle); |
|
||||||
|
|
||||||
super.paintComponents(g); |
|
||||||
} |
|
||||||
|
|
||||||
private void paintContentPane(Graphics g, BorderPacker borderStyle) { |
|
||||||
|
|
||||||
Graphics clipg; |
|
||||||
clipg = g.create(10, 40, this.contentPane.getWidth(), this.contentPane.getHeight()); |
|
||||||
if (borderStyle.getBackground() != null) { |
|
||||||
borderStyle.getBackground().paint(clipg, clipg.getClipBounds()); |
|
||||||
} |
|
||||||
clipg.dispose(); |
|
||||||
} |
|
||||||
|
|
||||||
private void paintTitle(Graphics g, TitlePacker titlePacker) { |
|
||||||
Background background = titlePacker.getBackground(); |
|
||||||
if (background != null) { |
|
||||||
background.paint(g, new Rectangle2D.Double(10, 5, this.titlePane.getWidth(), this.titlePane.getHeight())); |
|
||||||
} |
|
||||||
titlePane.setTitleObject(titlePacker); |
|
||||||
titlePane.paintComponent(g); |
|
||||||
} |
|
||||||
|
|
||||||
private void updateBorders(Graphics g, BorderPacker borderStyle) { |
|
||||||
if (borderStyle != null) { |
|
||||||
borderStyle.paint(g, new Rectangle2D.Double(SMALL_GAP, SMALL_GAP, getWidth() - GAP, getHeight() - SMALL_GAP - GAP)); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private class TitlePreviewPane extends JPanel { |
|
||||||
private FRFont frFont = null; |
|
||||||
private int titlePosition = Constants.LEFT; |
|
||||||
|
|
||||||
public TitlePreviewPane() { |
|
||||||
this.setBackground(null); |
|
||||||
this.setOpaque(false); |
|
||||||
frFont = FRContext.getDefaultValues().getFRFont(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void paint(Graphics g) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public void paintComponent(Graphics g) { |
|
||||||
Graphics2D g2d = (Graphics2D) g; |
|
||||||
Dimension d = getSize(); |
|
||||||
if (frFont == null) { |
|
||||||
return; |
|
||||||
} |
|
||||||
FontMetrics fm = getFontMetrics(frFont); |
|
||||||
if (this.isEnabled()) { |
|
||||||
g2d.setColor(frFont.getForeground()); |
|
||||||
} else { |
|
||||||
g2d.setColor(new Color(237, 237, 237)); |
|
||||||
} |
|
||||||
g2d.setFont(frFont.applyResolutionNP(96)); |
|
||||||
String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Preview_Title_Text"); |
|
||||||
int startY = 0, startX = 0; |
|
||||||
startX = (d.width - fm.stringWidth(paintText)) / 2; |
|
||||||
startY = (d.height - fm.getHeight()) / 2 + fm.getAscent(); |
|
||||||
if (this.titlePosition == Constants.LEFT) { |
|
||||||
startX = GAP; |
|
||||||
} else if (this.titlePosition == Constants.RIGHT) { |
|
||||||
startX = d.width - fm.stringWidth(paintText) - GAP - fm.getMaxAdvance(); |
|
||||||
} |
|
||||||
GraphHelper.drawString(g2d, paintText, startX, startY); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public void setTitleObject(TitlePacker titlePacker) { |
|
||||||
this.frFont = titlePacker.getFrFont(); |
|
||||||
this.titlePosition = titlePacker.getPosition(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,171 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.preview; |
|
||||||
|
|
||||||
import com.fr.base.ScreenResolution; |
|
||||||
import com.fr.base.Style; |
|
||||||
import com.fr.config.predefined.PredefinedCellStyle; |
|
||||||
import com.fr.config.predefined.PredefinedCellStyleConfig; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
import com.fr.third.javax.annotation.Nonnull; |
|
||||||
import javax.swing.JComponent; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.io.BufferedReader; |
|
||||||
import java.io.InputStream; |
|
||||||
import java.io.InputStreamReader; |
|
||||||
import java.nio.charset.StandardCharsets; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-04 |
|
||||||
*/ |
|
||||||
public class ElementCasePreview extends ComponentPreviewPane { |
|
||||||
private static final List<String[]> PREVIEW_DATA_LIST = new ArrayList<>(); |
|
||||||
private static final String BLANK_CHAR = " "; |
|
||||||
private List<GridRowPane> gridRowPanes; |
|
||||||
|
|
||||||
static { |
|
||||||
readPreviewData(); |
|
||||||
} |
|
||||||
|
|
||||||
private static void readPreviewData() { |
|
||||||
try { |
|
||||||
InputStream inputStream = ElementCasePreview.class.getResourceAsStream("/com/fr/design/mainframe/predefined/previewData"); |
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, |
|
||||||
StandardCharsets.UTF_8)); |
|
||||||
String lineTxt = null; |
|
||||||
while ((lineTxt = br.readLine()) != null) { |
|
||||||
String[] data = lineTxt.split(BLANK_CHAR); |
|
||||||
PREVIEW_DATA_LIST.add(data); |
|
||||||
} |
|
||||||
br.close(); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createContentPane() { |
|
||||||
gridRowPanes = new ArrayList<>(); |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
|
||||||
jPanel.setOpaque(false); |
|
||||||
jPanel.setBackground(null); |
|
||||||
for (int i = 0; i < PREVIEW_DATA_LIST.size(); i++) { |
|
||||||
GridRowPane gridRowPane = new GridRowPane(PREVIEW_DATA_LIST.get(i), Style.DEFAULT_STYLE); |
|
||||||
gridRowPanes.add(gridRowPane); |
|
||||||
jPanel.add(gridRowPane); |
|
||||||
} |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void refresh(PredefinedStyle style) { |
|
||||||
super.refresh(style); |
|
||||||
PredefinedCellStyleConfig cellStyleConfig = style.getCellStyleConfig(); |
|
||||||
for (int i = 0; i < gridRowPanes.size(); i++) { |
|
||||||
Style renderStyle = getMainContentStyle(cellStyleConfig); |
|
||||||
if (i == 0) { |
|
||||||
renderStyle = getReportHeaderStyle(cellStyleConfig); |
|
||||||
} |
|
||||||
if (i == PREVIEW_DATA_LIST.size() - 1) { |
|
||||||
renderStyle = getHighLightStyle(cellStyleConfig); |
|
||||||
} |
|
||||||
gridRowPanes.get(i).preview(renderStyle); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private Style getReportHeaderStyle(PredefinedCellStyleConfig config) { |
|
||||||
return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); |
|
||||||
} |
|
||||||
|
|
||||||
private Style getMainContentStyle(PredefinedCellStyleConfig config) { |
|
||||||
return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); |
|
||||||
} |
|
||||||
|
|
||||||
private Style getHighLightStyle(PredefinedCellStyleConfig config) { |
|
||||||
return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); |
|
||||||
} |
|
||||||
|
|
||||||
@Nonnull |
|
||||||
private Style getCellStyle(PredefinedCellStyleConfig config, String styleName) { |
|
||||||
PredefinedCellStyle cellStyle = config.getStyle(styleName); |
|
||||||
if (cellStyle == null) { |
|
||||||
return Style.DEFAULT_STYLE; |
|
||||||
} |
|
||||||
return cellStyle.getStyle(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
class GridRowPane extends JPanel { |
|
||||||
private List<GridPreview> gridPreviews = new ArrayList<>(); |
|
||||||
|
|
||||||
public GridRowPane(String[] data, Style style) { |
|
||||||
this.setOpaque(false); |
|
||||||
this.setBackground(null); |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
JPanel panel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(4, 0, 0); |
|
||||||
panel.setOpaque(false); |
|
||||||
panel.setBackground(null); |
|
||||||
for (String text : data) { |
|
||||||
GridPreview gridPreview = new GridPreview(text); |
|
||||||
gridPreviews.add(gridPreview); |
|
||||||
panel.add(gridPreview); |
|
||||||
} |
|
||||||
this.add(panel, BorderLayout.CENTER); |
|
||||||
preview(style); |
|
||||||
} |
|
||||||
|
|
||||||
public void preview(Style style) { |
|
||||||
for (GridPreview grid : gridPreviews) { |
|
||||||
grid.preview(style); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private static class GridPreview extends JComponent { |
|
||||||
|
|
||||||
private Style style = Style.DEFAULT_STYLE; |
|
||||||
private String value; |
|
||||||
|
|
||||||
public GridPreview(String value) { |
|
||||||
this.value = value; |
|
||||||
setPreferredSize(new Dimension(125, 30)); |
|
||||||
} |
|
||||||
|
|
||||||
public void preview(Style style) { |
|
||||||
this.style = style; |
|
||||||
} |
|
||||||
|
|
||||||
public void paint(Graphics g) { |
|
||||||
Graphics2D g2d = (Graphics2D) g; |
|
||||||
int resolution = ScreenResolution.getScreenResolution(); |
|
||||||
|
|
||||||
if (style == Style.DEFAULT_STYLE) { |
|
||||||
Style.paintContent(g2d, value, style, getWidth() - 3, getHeight() - 3, resolution); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
Style.paintBackground(g2d, style, getWidth(), getHeight()); |
|
||||||
|
|
||||||
Style.paintContent(g2d, value, style, getWidth() - 3, getHeight() - 3, resolution); |
|
||||||
|
|
||||||
Style.paintBorder(g2d, style, getWidth() , getHeight() ); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public Dimension getMinimumSize() { |
|
||||||
return getPreferredSize(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,157 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.preview; |
|
||||||
|
|
||||||
import com.fr.base.background.ColorBackground; |
|
||||||
import com.fr.base.chart.chartdata.CallbackEvent; |
|
||||||
import com.fr.chart.chartattr.ChartCollection; |
|
||||||
import com.fr.chart.chartattr.Title; |
|
||||||
import com.fr.chart.charttypes.ChartTypeManager; |
|
||||||
import com.fr.config.predefined.PredefinedStyle; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.utils.ComponentUtils; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
|
||||||
import com.fr.plugin.chart.base.AttrLabel; |
|
||||||
import com.fr.plugin.chart.base.VanChartTools; |
|
||||||
import com.fr.plugin.chart.column.VanChartColumnPlot; |
|
||||||
import com.fr.plugin.chart.vanchart.VanChart; |
|
||||||
|
|
||||||
import javax.swing.JComponent; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.awt.geom.Rectangle2D; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-06 |
|
||||||
*/ |
|
||||||
public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implements CallbackEvent { |
|
||||||
private ElementCasePreview elementCasePreview; |
|
||||||
private Background background; |
|
||||||
private double scaleX = 1.0; |
|
||||||
private double scaleY = 1.0; |
|
||||||
private ChartPreStylePreView columnChartPane; |
|
||||||
|
|
||||||
private int COLUMN_CHART_WIDTH = 517; |
|
||||||
private int COLUMN_CHART_HEIGHT = 290; |
|
||||||
|
|
||||||
private JPanel parent; |
|
||||||
|
|
||||||
public PredefinedStylePreviewPane() { |
|
||||||
this(1.0, 1.0); |
|
||||||
} |
|
||||||
|
|
||||||
public PredefinedStylePreviewPane(double scaleX, double scaleY) { |
|
||||||
this.scaleX = scaleX; |
|
||||||
this.scaleY = scaleY; |
|
||||||
this.setBackground(Color.WHITE); |
|
||||||
this.elementCasePreview = new ElementCasePreview(); |
|
||||||
this.add(initChartPreViewPane()); |
|
||||||
this.elementCasePreview.setPreferredSize(new Dimension(517, 200)); |
|
||||||
this.add(this.elementCasePreview); |
|
||||||
} |
|
||||||
|
|
||||||
public void setParent(JPanel parent) { |
|
||||||
this.parent = parent; |
|
||||||
} |
|
||||||
|
|
||||||
private JPanel initChartPreViewPane() { |
|
||||||
columnChartPane = new ChartPreStylePreView(initVanColumnChart()); |
|
||||||
columnChartPane.setPreferredSize(new Dimension(COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT)); |
|
||||||
columnChartPane.setCallbackEvent(this); |
|
||||||
|
|
||||||
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
||||||
panel.add(columnChartPane); |
|
||||||
return panel; |
|
||||||
} |
|
||||||
|
|
||||||
//柱形图
|
|
||||||
private ChartCollection initVanColumnChart() { |
|
||||||
try { |
|
||||||
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone(); |
|
||||||
VanChartTools vanChartTools = chart.getVanChartTools(); |
|
||||||
vanChartTools.setSort(false); |
|
||||||
vanChartTools.setExport(false); |
|
||||||
vanChartTools.setFullScreen(false); |
|
||||||
VanChartColumnPlot plot = chart.getPlot(); |
|
||||||
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel(); |
|
||||||
defaultAttrLabel.setEnable(true); |
|
||||||
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0); |
|
||||||
defaultAttrLabel.getAttrLabelDetail().getBackground().setBackground(null); |
|
||||||
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel); |
|
||||||
plot.getLegend().setLegendVisible(false); |
|
||||||
plot.getDataSheet().setVisible(true); |
|
||||||
|
|
||||||
VanChartAxis defaultYAxis = plot.getDefaultYAxis(); |
|
||||||
Title title = new Title(); |
|
||||||
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Axis_Title")); |
|
||||||
title.getTextAttr().setRotation(-90); |
|
||||||
defaultYAxis.setTitle(title); |
|
||||||
defaultYAxis.setShowAxisTitle(true); |
|
||||||
|
|
||||||
ChartCollection chartCollection = new ChartCollection(chart); |
|
||||||
return chartCollection; |
|
||||||
} catch (Exception ex) { |
|
||||||
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void refresh() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void paint(Graphics g) { |
|
||||||
((Graphics2D) g).scale(scaleX, scaleY); |
|
||||||
// 禁止双缓冲
|
|
||||||
ArrayList<JComponent> dbcomponents = new ArrayList<JComponent>(); |
|
||||||
ComponentUtils.disableBuffer(this.elementCasePreview, dbcomponents); |
|
||||||
|
|
||||||
if (background == null) { |
|
||||||
background = ColorBackground.getInstance(Color.WHITE); |
|
||||||
} |
|
||||||
background.paint(g, new Rectangle2D.Double(0, 0, 517, 500)); |
|
||||||
this.columnChartPane.paintComponent(g); |
|
||||||
|
|
||||||
g.translate(0, COLUMN_CHART_HEIGHT); |
|
||||||
this.elementCasePreview.paintComponents(g); |
|
||||||
g.translate(0, -COLUMN_CHART_HEIGHT); |
|
||||||
// 恢复双缓冲
|
|
||||||
ComponentUtils.resetBuffer(dbcomponents); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void paintComponents(Graphics g) { |
|
||||||
super.paintComponents(g); |
|
||||||
if (background != null) { |
|
||||||
background.paint(g, new Rectangle2D.Double(0, 0, this.getWidth(), this.getHeight())); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void refresh(PredefinedStyle style) { |
|
||||||
refresh(style, false); |
|
||||||
} |
|
||||||
|
|
||||||
public void refresh(PredefinedStyle style, boolean displayFormBackground) { |
|
||||||
elementCasePreview.refresh(style); |
|
||||||
columnChartPane.refresh(style); |
|
||||||
background = displayFormBackground ? style.getFormBackground().getBackground() : style.getReportBackground(); |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void callback() { |
|
||||||
if (parent != null) { |
|
||||||
parent.repaint(); |
|
||||||
} else { |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,17 +0,0 @@ |
|||||||
package com.fr.design.mainframe.predefined.ui.preview; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-31 |
|
||||||
*/ |
|
||||||
public abstract class StyleSettingPreviewPane extends JPanel { |
|
||||||
public StyleSettingPreviewPane() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public abstract void refresh(); |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,5 +0,0 @@ |
|||||||
城市 当月目标 当月实际完成 月度完成率 |
|
||||||
南通市 324,646 324,646 100% |
|
||||||
合肥市 248,938 348,938 140% |
|
||||||
邵阳市 248,938 348,938 140% |
|
||||||
合计 1,071,460 1,371,460 128% |
|
@ -1,110 +0,0 @@ |
|||||||
package com.fr.design.gui.xpane; |
|
||||||
|
|
||||||
import com.fr.config.predefined.BackgroundWithAlpha; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundWithAlphaSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; |
|
||||||
import com.fr.form.ui.NameComponentBackground; |
|
||||||
import com.fr.form.ui.NameFormBackground; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.geom.Rectangle2D; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public class FormPredefinedBackgroundPane extends PredefinedStyleSettingPane<NameComponentBackground> { |
|
||||||
private BackgroundWithAlphaSettingPane backgroundPane; |
|
||||||
|
|
||||||
@Override |
|
||||||
protected StyleSettingPreviewPane createPreviewPane() { |
|
||||||
return new PreviewPane(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createCustomDetailPane() { |
|
||||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
backgroundPane = new BackgroundWithAlphaSettingPane(); |
|
||||||
backgroundPane.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
previewPane.refresh(); |
|
||||||
} |
|
||||||
}); |
|
||||||
panel.add(backgroundPane, BorderLayout.CENTER); |
|
||||||
return panel; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(NameComponentBackground ob) { |
|
||||||
this.setPopulating(true); |
|
||||||
super.populate(ob); |
|
||||||
this.backgroundPane.populateBean(ob.createRealStyle()); |
|
||||||
this.previewPane.refresh(); |
|
||||||
this.setPopulating(false); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public NameComponentBackground updateBean() { |
|
||||||
if (this.predefinedRadioBtn.isSelected()) { |
|
||||||
return NameFormBackground.createPredefinedStyle(getPredefinedStyleName()); |
|
||||||
} else { |
|
||||||
return NameFormBackground.createCustomStyle(this.backgroundPane.updateBean()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private BackgroundWithAlpha getCurrentValue() { |
|
||||||
if (this.predefinedRadioBtn.isSelected()) { |
|
||||||
return updatePredefinedStyle(); |
|
||||||
} else { |
|
||||||
return this.backgroundPane.updateBean(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private BackgroundWithAlpha updatePredefinedStyle(){ |
|
||||||
NameComponentBackground componentBackground = NameFormBackground.createPredefinedStyle(getPredefinedStyleName()); |
|
||||||
return componentBackground.createRealStyle(); |
|
||||||
} |
|
||||||
|
|
||||||
protected void populateCustomPane(){ |
|
||||||
this.backgroundPane.populateBean(updatePredefinedStyle()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"); |
|
||||||
} |
|
||||||
|
|
||||||
class PreviewPane extends StyleSettingPreviewPane { |
|
||||||
private BackgroundWithAlpha background; |
|
||||||
|
|
||||||
public PreviewPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setPreferredSize(new Dimension(390, 511)); |
|
||||||
this.setBackground(Color.WHITE); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void refresh() { |
|
||||||
background = getCurrentValue(); |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void paint(Graphics g) { |
|
||||||
super.paint(g); |
|
||||||
if (background != null && background.getBackground() != null) { |
|
||||||
background.getBackground().paint(g, new Rectangle2D.Double(0, 0, this.getWidth(), this.getHeight())); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,152 +0,0 @@ |
|||||||
package com.fr.design.gui.xpane; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedComponentStyle; |
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.formula.TinyFormulaPane; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.component.ComponentFrameStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.component.ComponentTitleStylePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; |
|
||||||
import com.fr.form.ui.LayoutBorderStyle; |
|
||||||
import com.fr.form.ui.NameLayoutBorderStyle; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.FlowLayout; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingPane<NameLayoutBorderStyle> { |
|
||||||
private StyleSettingPane styleSettingPane; |
|
||||||
private TinyFormulaPane formulaPane; |
|
||||||
|
|
||||||
@Override |
|
||||||
protected StyleSettingPreviewPane createPreviewPane() { |
|
||||||
return new PreviewPane(); |
|
||||||
} |
|
||||||
|
|
||||||
protected JPanel createPredefinedSettingPane() { |
|
||||||
JPanel jPanel = new JPanel(); |
|
||||||
jPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); |
|
||||||
jPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content"))); |
|
||||||
formulaPane = new TinyFormulaPane(); |
|
||||||
formulaPane.setPreferredSize(new Dimension(158, 30)); |
|
||||||
jPanel.add(formulaPane); |
|
||||||
return jPanel; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createCustomDetailPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
styleSettingPane = new StyleSettingPane(); |
|
||||||
jPanel.add(styleSettingPane, BorderLayout.CENTER); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(NameLayoutBorderStyle ob) { |
|
||||||
this.setPopulating(true); |
|
||||||
super.populate(ob); |
|
||||||
this.formulaPane.populateBean(ob.getTitleText().toString()); |
|
||||||
styleSettingPane.populateBean(ob); |
|
||||||
this.previewPane.refresh(); |
|
||||||
this.setPopulating(false); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public NameLayoutBorderStyle updateBean() { |
|
||||||
if (predefinedRadioBtn.isSelected()) { |
|
||||||
return updatePredefinedStyle(); |
|
||||||
} |
|
||||||
return styleSettingPane.updateBean(); |
|
||||||
} |
|
||||||
|
|
||||||
private NameLayoutBorderStyle updatePredefinedStyle() { |
|
||||||
NameLayoutBorderStyle layoutBorderStyle = NameLayoutBorderStyle.createPredefinedStyle(getPredefinedStyleName()); |
|
||||||
layoutBorderStyle.setTitleText(formulaPane.updateBean()); |
|
||||||
return layoutBorderStyle; |
|
||||||
} |
|
||||||
|
|
||||||
protected void populateCustomPane() { |
|
||||||
this.styleSettingPane.populateBean(updatePredefinedStyle()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Style"); |
|
||||||
} |
|
||||||
|
|
||||||
class StyleSettingPane extends BasicBeanPane<NameLayoutBorderStyle> { |
|
||||||
private ComponentFrameStylePane frameStylePane; |
|
||||||
private ComponentTitleStylePane titleStylePane; |
|
||||||
|
|
||||||
public StyleSettingPane() { |
|
||||||
initPane(); |
|
||||||
} |
|
||||||
|
|
||||||
private void initPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
JPanel frame = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame")); |
|
||||||
frameStylePane = new ComponentFrameStylePane(); |
|
||||||
frameStylePane.setPreferredSize(new Dimension(233, 225)); |
|
||||||
frame.add(frameStylePane); |
|
||||||
|
|
||||||
JPanel title = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title")); |
|
||||||
titleStylePane = ComponentTitleStylePane.createStyleSettingPane(); |
|
||||||
titleStylePane.setPreferredSize(new Dimension(233, 220)); |
|
||||||
title.add(titleStylePane); |
|
||||||
|
|
||||||
this.add(frame, BorderLayout.NORTH); |
|
||||||
this.add(title, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(NameLayoutBorderStyle ob) { |
|
||||||
PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); |
|
||||||
componentStyle.setBorderStyle(ob.createRealStyle()); |
|
||||||
frameStylePane.populate(componentStyle); |
|
||||||
titleStylePane.populate(componentStyle); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public NameLayoutBorderStyle updateBean() { |
|
||||||
PredefinedComponentStyle componentStyle = update(); |
|
||||||
NameLayoutBorderStyle nameLayoutBorderStyle = NameLayoutBorderStyle.createCustomStyle(componentStyle.getBorderStyle()); |
|
||||||
return nameLayoutBorderStyle; |
|
||||||
} |
|
||||||
|
|
||||||
public PredefinedComponentStyle update() { |
|
||||||
PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); |
|
||||||
frameStylePane.update(componentStyle); |
|
||||||
titleStylePane.update(componentStyle); |
|
||||||
return componentStyle; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
class PreviewPane extends StyleSettingPreviewPane { |
|
||||||
private LayoutBorderPreviewPane layoutBorderPreviewPane; |
|
||||||
|
|
||||||
public PreviewPane() { |
|
||||||
this.setPreferredSize(new Dimension(390, 511)); |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.layoutBorderPreviewPane = new LayoutBorderPreviewPane(new LayoutBorderStyle()); |
|
||||||
this.add(this.layoutBorderPreviewPane, BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
public void refresh() { |
|
||||||
NameLayoutBorderStyle componentStyle = PredefinedComponentStyleSettingPane.this.updateBean(); |
|
||||||
this.layoutBorderPreviewPane.repaint((LayoutBorderStyle) componentStyle.createRealStyle()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,99 +0,0 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
|
||||||
|
|
||||||
import com.fr.design.Exception.ValidationException; |
|
||||||
import com.fr.design.designer.properties.Decoder; |
|
||||||
import com.fr.design.designer.properties.Encoder; |
|
||||||
import com.fr.design.dialog.BasicDialog; |
|
||||||
import com.fr.design.dialog.DialogActionAdapter; |
|
||||||
import com.fr.design.gui.xpane.FormPredefinedBackgroundPane; |
|
||||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
|
||||||
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; |
|
||||||
import com.fr.form.ui.NameComponentBackground; |
|
||||||
|
|
||||||
import javax.swing.SwingUtilities; |
|
||||||
import java.awt.Dimension; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public class AccessibleBodyBackgroundEditor extends UneditableAccessibleEditor { |
|
||||||
private FormPredefinedBackgroundPane backgroundPane; |
|
||||||
|
|
||||||
public AccessibleBodyBackgroundEditor() { |
|
||||||
super(new BackgroundStyleWrapper()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected ITextComponent createTextField() { |
|
||||||
return new RendererField(new BackgroundStyleRender()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void showEditorPane() { |
|
||||||
if (backgroundPane == null) { |
|
||||||
backgroundPane = new FormPredefinedBackgroundPane(); |
|
||||||
backgroundPane.setPreferredSize(new Dimension(600, 400)); |
|
||||||
} |
|
||||||
BasicDialog dlg = backgroundPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
|
||||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
|
||||||
|
|
||||||
@Override |
|
||||||
public void doOk() { |
|
||||||
setValue(backgroundPane.updateBean()); |
|
||||||
fireStateChanged(); |
|
||||||
} |
|
||||||
}); |
|
||||||
backgroundPane.populateBean((NameComponentBackground) getValue()); |
|
||||||
dlg.setVisible(true); |
|
||||||
} |
|
||||||
|
|
||||||
private static class BackgroundStyleWrapper implements Encoder, Decoder { |
|
||||||
public BackgroundStyleWrapper() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 将属性转化成字符串 |
|
||||||
* |
|
||||||
* @param v 属性对象 |
|
||||||
* @return 字符串 |
|
||||||
*/ |
|
||||||
public String encode(Object v) { |
|
||||||
if (v == null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
NameComponentBackground style = (NameComponentBackground) v; |
|
||||||
return style.usePredefinedStyle() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined") |
|
||||||
: com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 将字符串转化成属性 |
|
||||||
* |
|
||||||
* @param txt 字符串 |
|
||||||
* @return 属性对象 |
|
||||||
*/ |
|
||||||
public Object decode(String txt) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 符合规则 |
|
||||||
* |
|
||||||
* @param txt 字符串 |
|
||||||
* @throws ValidationException 抛错 |
|
||||||
*/ |
|
||||||
public void validate(String txt) throws ValidationException { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private static class BackgroundStyleRender extends EncoderCellRenderer { |
|
||||||
|
|
||||||
public BackgroundStyleRender() { |
|
||||||
super(new BackgroundStyleWrapper()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,100 +0,0 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
|
||||||
|
|
||||||
import com.fr.design.Exception.ValidationException; |
|
||||||
import com.fr.design.designer.properties.Decoder; |
|
||||||
import com.fr.design.designer.properties.Encoder; |
|
||||||
import com.fr.design.dialog.BasicDialog; |
|
||||||
import com.fr.design.dialog.DialogActionAdapter; |
|
||||||
import com.fr.design.gui.xpane.PredefinedComponentStyleSettingPane; |
|
||||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
|
||||||
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; |
|
||||||
import com.fr.form.ui.NameLayoutBorderStyle; |
|
||||||
|
|
||||||
import javax.swing.SwingUtilities; |
|
||||||
import java.awt.Dimension; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-07 |
|
||||||
*/ |
|
||||||
public class AccessibleBorderStyleEditor extends UneditableAccessibleEditor { |
|
||||||
private PredefinedComponentStyleSettingPane borderPane; |
|
||||||
|
|
||||||
public AccessibleBorderStyleEditor() { |
|
||||||
super(new ComponentStyleWrapper()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected ITextComponent createTextField() { |
|
||||||
return new RendererField(new ComponentStyleRenderer()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void showEditorPane() { |
|
||||||
if (borderPane == null) { |
|
||||||
borderPane = new PredefinedComponentStyleSettingPane(); |
|
||||||
borderPane.setPreferredSize(new Dimension(600, 400)); |
|
||||||
} |
|
||||||
BasicDialog dlg = borderPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
|
||||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
|
||||||
|
|
||||||
@Override |
|
||||||
public void doOk() { |
|
||||||
setValue(borderPane.updateBean()); |
|
||||||
fireStateChanged(); |
|
||||||
} |
|
||||||
}); |
|
||||||
borderPane.populateBean((NameLayoutBorderStyle) getValue()); |
|
||||||
dlg.setVisible(true); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private static class ComponentStyleWrapper implements Encoder, Decoder { |
|
||||||
public ComponentStyleWrapper() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 将属性转化成字符串 |
|
||||||
* |
|
||||||
* @param v 属性对象 |
|
||||||
* @return 字符串 |
|
||||||
*/ |
|
||||||
public String encode(Object v) { |
|
||||||
if (v == null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
NameLayoutBorderStyle style = (NameLayoutBorderStyle) v; |
|
||||||
return style.usePredefinedStyle() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined") : |
|
||||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Custom"); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 将字符串转化成属性 |
|
||||||
* |
|
||||||
* @param txt 字符串 |
|
||||||
* @return 属性对象 |
|
||||||
*/ |
|
||||||
public Object decode(String txt) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 符合规则 |
|
||||||
* |
|
||||||
* @param txt 字符串 |
|
||||||
* @throws ValidationException 抛错 |
|
||||||
*/ |
|
||||||
public void validate(String txt) throws ValidationException { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private static class ComponentStyleRenderer extends EncoderCellRenderer { |
|
||||||
|
|
||||||
public ComponentStyleRenderer() { |
|
||||||
super(new ComponentStyleWrapper()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,56 +0,0 @@ |
|||||||
package com.fr.design.actions.server.predefined; |
|
||||||
|
|
||||||
import com.fr.design.mainframe.predefined.ui.dialog.ServerPredefinedStyleDialog; |
|
||||||
import com.fr.design.mainframe.predefined.ui.ServerPredefinedStylePane; |
|
||||||
import com.fr.design.mainframe.DesignerContext; |
|
||||||
import com.fr.design.mainframe.DesignerFrame; |
|
||||||
import com.fr.design.menu.MenuKeySet; |
|
||||||
import com.fr.design.menu.SnapChatUpdateAction; |
|
||||||
import com.fr.design.notification.SnapChatKey; |
|
||||||
//import com.fr.design.utils.PredefinedStyleUtils;
|
|
||||||
import com.fr.general.IOUtils; |
|
||||||
|
|
||||||
import javax.swing.KeyStroke; |
|
||||||
import java.awt.event.ActionEvent; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-08-26 |
|
||||||
*/ |
|
||||||
public class ServerPredefinedStyleAction extends SnapChatUpdateAction { |
|
||||||
|
|
||||||
|
|
||||||
public ServerPredefinedStyleAction(SnapChatKey uniqueKey) { |
|
||||||
super(uniqueKey); |
|
||||||
// this.setEnabled(PredefinedStyleUtils.isAllowPredefinedSetting());
|
|
||||||
this.setMenuKeySet(PREDEFINED_STYLES); |
|
||||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
|
||||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
|
||||||
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); |
|
||||||
this.generateAndSetSearchText(ServerPredefinedStylePane.class.getName()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void actionPerformed0(ActionEvent e) { |
|
||||||
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
|
||||||
ServerPredefinedStylePane predefinedStylePane = new ServerPredefinedStylePane(); |
|
||||||
ServerPredefinedStyleDialog dialog = new ServerPredefinedStyleDialog(designerFrame, predefinedStylePane); |
|
||||||
dialog.setVisible(true); |
|
||||||
} |
|
||||||
|
|
||||||
public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { |
|
||||||
@Override |
|
||||||
public char getMnemonic() { |
|
||||||
return 'K'; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String getMenuName() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Server_Style"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public KeyStroke getKeyStroke() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
@ -1,246 +0,0 @@ |
|||||||
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.design.actions.utils.ReportActionUtils; |
|
||||||
import com.fr.design.constants.UIConstants; |
|
||||||
import com.fr.design.designer.IntervalConstants; |
|
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.design.dialog.MultiTabPane; |
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.gui.style.AbstractBasicStylePane; |
|
||||||
import com.fr.design.gui.style.AlignmentPane; |
|
||||||
import com.fr.design.gui.style.BorderPane; |
|
||||||
import com.fr.design.gui.style.FormatPane; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.mainframe.ElementCasePane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; |
|
||||||
import com.fr.design.style.BorderUtils; |
|
||||||
//import com.fr.predefined.PredefinedPatternStyleManager;
|
|
||||||
import com.fr.third.javax.annotation.Nonnull; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.JPanel; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Component; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.GridLayout; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<NameStyle> { |
|
||||||
|
|
||||||
private CustomStylePane customPredefinedStylePane; |
|
||||||
|
|
||||||
private UIComboBox applicationFormat; |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected StyleSettingPreviewPane createPreviewPane() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createCustomDetailPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
customPredefinedStylePane = new CustomStylePane(); |
|
||||||
jPanel.add(customPredefinedStylePane, BorderLayout.CENTER); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
protected JPanel createPredefinedSettingPane() { |
|
||||||
|
|
||||||
applicationFormat = new UIComboBox(); |
|
||||||
applicationFormat.setPreferredSize(new Dimension(140, 20)); |
|
||||||
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ |
|
||||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Applicate_Format")), applicationFormat} |
|
||||||
}, TableLayoutHelper.FILL_NONE, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1); |
|
||||||
|
|
||||||
return centerPane; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(NameStyle ob) { |
|
||||||
this.setPopulating(true); |
|
||||||
// super.populate(ob);
|
|
||||||
// PredefinedStyle currentStyle = PredefinedPatternStyleManager.INSTANCE.getStyleFromName(getPredefinedStyleName());
|
|
||||||
// PredefinedCellStyleConfig config = currentStyle.getCellStyleConfig();
|
|
||||||
// Map<String, PredefinedCellStyle> allStyle = config.getAllStyles();
|
|
||||||
// this.applicationFormat.clearBoxItems();
|
|
||||||
// for (String name : allStyle.keySet()) {
|
|
||||||
// this.applicationFormat.addItem(name);
|
|
||||||
// }
|
|
||||||
// if (allStyle.containsKey(ob.getName())) {
|
|
||||||
// this.applicationFormat.setSelectedItem(ob.getName());
|
|
||||||
// }else {
|
|
||||||
// this.applicationFormat.setSelectedItem(config.getDefaultStyleName());
|
|
||||||
// }
|
|
||||||
// this.customPredefinedStylePane.populateBean(ob);
|
|
||||||
// this.setPopulating(false);
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
protected void populateCustomPane(){ |
|
||||||
this.customPredefinedStylePane.populateBean(updatePredefinedStyle()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void dealWithBorder(ElementCasePane ePane) { |
|
||||||
|
|
||||||
this.customPredefinedStylePane.dealWithBorder(ePane); |
|
||||||
} |
|
||||||
|
|
||||||
public void updateBorder() { |
|
||||||
this.customPredefinedStylePane.updateBorder(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
@Nonnull |
|
||||||
public NameStyle updateBean() { |
|
||||||
Style style = updateStyle(); |
|
||||||
if (!(style instanceof NameStyle)) { |
|
||||||
// return NameStyle.createCustomStyle(style);
|
|
||||||
} |
|
||||||
return (NameStyle) style; |
|
||||||
} |
|
||||||
|
|
||||||
@Nonnull |
|
||||||
public Style updateStyle() { |
|
||||||
if (this.predefinedRadioBtn.isSelected()) { |
|
||||||
return updatePredefinedStyle(); |
|
||||||
} else { |
|
||||||
return this.customPredefinedStylePane.updateBean(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private NameStyle updatePredefinedStyle() { |
|
||||||
Object selectItem = this.applicationFormat.getSelectedItem(); |
|
||||||
// return NameStyle.createPredefinedStyle(getPredefinedStyleName(), selectItem == null ? StringUtils.EMPTY : selectItem.toString(), Style.getInstance());
|
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
class CustomStylePane extends MultiTabPane<Style> { |
|
||||||
private static final int LENGTH_FOUR = 4; |
|
||||||
private static final int THREE_INDEX = 3; |
|
||||||
private static final int ONE_INDEX = 1; |
|
||||||
private ElementCasePane reportPane; |
|
||||||
|
|
||||||
|
|
||||||
public CustomStylePane() { |
|
||||||
super(); |
|
||||||
tabPane.setOneLineTab(true); |
|
||||||
tabPane.setDrawLine(false); |
|
||||||
tabPane.setBorder(BorderFactory.createLineBorder(UIConstants.SHADOW_GREY)); |
|
||||||
tabPane.setLayout(new GridLayout(1, 3, 0, 0)); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Style"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void reset() { |
|
||||||
populateBean(null); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void populateBean(Style ob) { |
|
||||||
for (int i = 0; i < paneList.size(); i++) { |
|
||||||
((AbstractBasicStylePane) paneList.get(i)).populateBean(ob); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public Style updateBean() { |
|
||||||
return updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param style |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public Style updateStyle(Style style) { |
|
||||||
return ((AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex())).update(style);//只更新当前选中面板的样式
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public boolean isBorderPaneSelected() { |
|
||||||
return tabPane.getSelectedIndex() == ONE_INDEX; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param ePane |
|
||||||
*/ |
|
||||||
public void dealWithBorder(ElementCasePane ePane) { |
|
||||||
this.reportPane = ePane; |
|
||||||
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); |
|
||||||
|
|
||||||
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) { |
|
||||||
if (fourObjectArray.length == LENGTH_FOUR) { |
|
||||||
((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue()); |
|
||||||
} else { |
|
||||||
((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void updateBorder() { |
|
||||||
BorderUtils.update(reportPane, ((BorderPane) paneList.get(ONE_INDEX)).update()); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param ob |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public boolean accept(Object ob) { |
|
||||||
return ob instanceof Style && !(ob instanceof NameStyle); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected List<BasicPane> initPaneList() { |
|
||||||
paneList = new ArrayList<BasicPane>(); |
|
||||||
paneList.add(new FormatPane()); |
|
||||||
paneList.add(new BorderPane()); |
|
||||||
paneList.add(new AlignmentPane()); |
|
||||||
return paneList; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
public void updateBean(Style ob) { |
|
||||||
return; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,137 +0,0 @@ |
|||||||
package com.fr.design.report; |
|
||||||
|
|
||||||
import com.fr.config.predefined.PredefinedNameStyleProvider; |
|
||||||
import com.fr.form.ui.NameBackground; |
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.detail.background.BackgroundSettingPane; |
|
||||||
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; |
|
||||||
import com.fr.general.Background; |
|
||||||
import com.fr.page.ReportSettingsProvider; |
|
||||||
import com.fr.report.stable.ReportSettings; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
import java.awt.BorderLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.Graphics; |
|
||||||
import java.awt.geom.Rectangle2D; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by kerry on 2020-09-02 |
|
||||||
*/ |
|
||||||
public class ReportPredefinedBackgroundPane extends PredefinedStyleSettingPane<ReportSettingsProvider> { |
|
||||||
private UICheckBox isPrintBackgroundCheckBox; |
|
||||||
private UICheckBox isExportBackgroundCheckBox; |
|
||||||
private BackgroundSettingPane backgroundPane; |
|
||||||
|
|
||||||
|
|
||||||
public ReportPredefinedBackgroundPane() { |
|
||||||
super(); |
|
||||||
JPanel sourth = new JPanel(); |
|
||||||
isPrintBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Background")); |
|
||||||
isExportBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Background")); |
|
||||||
sourth.add(isExportBackgroundCheckBox); |
|
||||||
sourth.add(isPrintBackgroundCheckBox); |
|
||||||
this.add(sourth, BorderLayout.SOUTH); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Background"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected StyleSettingPreviewPane createPreviewPane() { |
|
||||||
return new PreviewPane(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel createCustomDetailPane() { |
|
||||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
backgroundPane = new BackgroundSettingPane(); |
|
||||||
backgroundPane.addChangeListener(new ChangeListener() { |
|
||||||
@Override |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
previewPane.refresh(); |
|
||||||
} |
|
||||||
}); |
|
||||||
jPanel.add(backgroundPane, BorderLayout.CENTER); |
|
||||||
return jPanel; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void populateBean(ReportSettingsProvider reportSettings) { |
|
||||||
this.setPopulating(true); |
|
||||||
// PredefinedNameStyleProvider nameBackground = reportSettings.getNameBackground();
|
|
||||||
// super.populate(nameBackground);
|
|
||||||
this.backgroundPane.populateBean(reportSettings.getBackground()); |
|
||||||
this.isPrintBackgroundCheckBox.setSelected(reportSettings.isPrintBackground()); |
|
||||||
this.isExportBackgroundCheckBox.setSelected(reportSettings.isExportBackground()); |
|
||||||
this.previewPane.refresh(); |
|
||||||
this.setPopulating(false); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public ReportSettingsProvider updateBean() { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void updateBean(ReportSettingsProvider reportSettings) { |
|
||||||
if (this.predefinedRadioBtn.isSelected()) { |
|
||||||
// ((ReportSettings) reportSettings).setNameBackground(updatePredefinedStyle());
|
|
||||||
} else { |
|
||||||
reportSettings.setBackground(this.backgroundPane.updateBean()); |
|
||||||
} |
|
||||||
reportSettings.setPrintBackground(this.isPrintBackgroundCheckBox.isSelected()); |
|
||||||
reportSettings.setExportBackground(this.isExportBackgroundCheckBox.isSelected()); |
|
||||||
} |
|
||||||
|
|
||||||
private NameBackground updatePredefinedStyle() { |
|
||||||
return NameBackground.createPredefinedStyle(getPredefinedStyleName()); |
|
||||||
} |
|
||||||
|
|
||||||
protected void populateCustomPane() { |
|
||||||
this.backgroundPane.populateBean(updatePredefinedStyle().createRealStyle()); |
|
||||||
} |
|
||||||
|
|
||||||
private Background getCurrentValue() { |
|
||||||
if (this.predefinedRadioBtn.isSelected()) { |
|
||||||
NameBackground nameReportBackground = NameBackground.createPredefinedStyle(getPredefinedStyleName()); |
|
||||||
return nameReportBackground.createRealStyle(); |
|
||||||
} else { |
|
||||||
return this.backgroundPane.updateBean(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
class PreviewPane extends StyleSettingPreviewPane { |
|
||||||
private Background background; |
|
||||||
|
|
||||||
public PreviewPane() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
this.setPreferredSize(new Dimension(390, 478)); |
|
||||||
this.setBackground(Color.WHITE); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void refresh() { |
|
||||||
background = getCurrentValue(); |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void paint(Graphics g) { |
|
||||||
super.paint(g); |
|
||||||
if (background != null) { |
|
||||||
background.paint(g, new Rectangle2D.Double(0, 0, this.getWidth(), this.getHeight())); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
Loading…
Reference in new issue