Browse Source

Merge branch 'feature/x' of ssh://code.fineres.com:7999/~tommy/design into feature/x

research/11.0
kuangshuai 3 years ago
parent
commit
ebf80e424b
  1. 1
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  2. 85
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  3. 88
      designer-base/src/main/java/com/fr/design/gui/style/TextFontTippedPane.java
  4. 485
      designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java
  5. 7
      designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java
  6. 18
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  7. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/NoBorderPaneCellStyleEditPane.java
  9. 27
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java
  10. 3
      designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java
  11. 10
      designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java
  12. 29
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  13. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  14. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  15. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  16. 34
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  17. 13
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  18. 12
      designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java
  19. 18
      designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java
  20. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  21. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  22. 17
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  23. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  24. 4
      designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java
  25. 83
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java
  26. 52
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  27. 55
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

1
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -43,6 +43,7 @@ public class CellStylePreviewPane extends JPanel {
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g.clearRect(0, 0, getWidth(), getHeight());
paintTransparentBackground(g2d, style);

85
designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java

@ -17,6 +17,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -56,11 +57,11 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private static final int GAP = 23;
private static final int VERGAP = 3;
private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20);
private static final String[] TEXT = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Wrap_Text"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Single_Line"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Single_Line(Adjust_Font)"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Multi_Line(Adjust_Font)")};
private static final String[] TEXT = {Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Wrap_Text"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Single_Line"),
Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Single_Line(Adjust_Font)"), Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Multi_Line(Adjust_Font)")};
private static final String[] LAYOUT = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Default"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Titled"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Extend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Adjust")};
private static final String[] LAYOUT = {Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Default"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Titled"),
Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Extend"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Adjust")};
private JPanel hPaneContainer;
private JPanel vPaneContainer;
@ -103,8 +104,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL};
hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")});
hAlignmentPane.setAllToolTips(new String[]{Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"),
Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")});
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
@ -113,7 +114,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}};
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM};
vAlignmentPane = new UIButtonGroup<>(vAlignmentIconArray, vAlignment);
vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")});
vAlignmentPane.setAllToolTips(new String[]{Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")});
initOtherComponent();
initAllNames();
@ -175,7 +176,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private void initTextRotationCombox() {
ArrayList<String> selectOption = new ArrayList<>();
selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle"));
selectOption.add(Toolkit.i18nText("Fine-Design_Basic_Custom_Angle"));
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class);
selectOption.addAll(Arrays.asList(processor.getComboxOption()));
@ -183,25 +184,25 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
}
private void initAllNames() {
hAlignmentPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"));
vAlignmentPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical"));
imageLayoutComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Layout"));
textComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style"));
textRotationComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"));
rotationPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"));
leftIndentSpinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Left_Indent"));
rightIndentSpinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Right_Indent"));
spaceBeforeSpinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_Before"));
spaceAfterSpinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_After"));
lineSpaceSpinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing"));
hAlignmentPane.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"));
vAlignmentPane.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical"));
imageLayoutComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Image_Layout"));
textComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style"));
textRotationComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"));
rotationPane.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"));
leftIndentSpinner.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Left_Indent"));
rightIndentSpinner.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Right_Indent"));
spaceBeforeSpinner.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_Before"));
spaceAfterSpinner.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_After"));
lineSpaceSpinner.setGlobalName(Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing"));
}
private JPanel createPane() {
JPanel jp1 = new JPanel(new BorderLayout());
basicPane = new JPanel();
seniorPane = new JPanel();
basicPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 290, 24, basicPane());
seniorPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced"), 290, 24, seniorPane());
basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 290, 24, basicPane());
seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Basic_Advanced"), 290, 24, seniorPane());
jp1.add(basicPane, BorderLayout.NORTH);
jp1.add(seniorPane, BorderLayout.CENTER);
@ -212,13 +213,13 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private JPanel basicPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
UILabel horizontalLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal") + " ", SwingConstants.LEFT);
UILabel horizontalLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal") + " ", SwingConstants.LEFT);
UIComponentUtils.setLineWrap(horizontalLabel);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{horizontalLabel, hPaneContainer},
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer},
new Component[]{null, null}
};
double[] rowSize = {p, p, p, p, p, p};
@ -233,11 +234,11 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Layout")) + " ", SwingConstants.LEFT), imageLayoutComboBox},
new Component[]{new UILabel((Toolkit.i18nText("Fine-Design_Basic_Image_Layout")) + " ", SwingConstants.LEFT), imageLayoutComboBox},
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style") + " ", SwingConstants.LEFT), textComboBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style") + " ", SwingConstants.LEFT), textComboBox},
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation") + " ", SwingConstants.LEFT), textRotationComboBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation") + " ", SwingConstants.LEFT), textRotationComboBox},
new Component[]{null, rotationBarCC},
new Component[]{null, null},
};
@ -261,23 +262,23 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
lineSpaceSpinner.setPreferredSize(SPINNER_DIMENSION);
JPanel indentationPane = new JPanel(new BorderLayout());
indentationPane.add(new UILabel((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Indentation")), SwingConstants.LEFT));
indentationPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Indentation")), SwingConstants.LEFT));
indentationPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, GAP));
JPanel partSpacingPane = new JPanel(new BorderLayout());
partSpacingPane.add(new UILabel((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Part_Spacing")), SwingConstants.LEFT));
partSpacingPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Part_Spacing")), SwingConstants.LEFT));
partSpacingPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, GAP));
JPanel spacingPane = new JPanel(new BorderLayout());
spacingPane.add(new UILabel((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Spacing")), SwingConstants.LEFT));
spacingPane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing")), SwingConstants.LEFT));
spacingPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, GAP));
Component[][] components = new Component[][]{
new Component[]{null, null, null},
new Component[]{indentationPane, creatSpinnerPane(leftIndentSpinner), creatSpinnerPane(rightIndentSpinner)},
new Component[]{null, 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)},
new Component[]{null, new UILabel((Toolkit.i18nText("Fine-Design_Report_Left")), SwingConstants.CENTER), new UILabel((Toolkit.i18nText("Fine-Design_Basic_Right")), SwingConstants.CENTER)},
new Component[]{null, null, null},
new Component[]{null, null, null},
new Component[]{partSpacingPane, creatSpinnerPane(spaceBeforeSpinner), creatSpinnerPane(spaceAfterSpinner)},
new Component[]{null, new UILabel((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Front")), SwingConstants.CENTER), new UILabel((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Behind")), SwingConstants.CENTER)},
new Component[]{null, new UILabel((Toolkit.i18nText("Fine-Design_Basic_Front")), SwingConstants.CENTER), new UILabel((Toolkit.i18nText("Fine-Design_Basic_Behind")), SwingConstants.CENTER)},
new Component[]{null, null, null},
new Component[]{null, null, null},
new Component[]{spacingPane, creatSpinnerPane(lineSpaceSpinner), null},
@ -300,7 +301,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
* @return 标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Alignment");
return Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Style_Alignment");
}
/**
@ -363,18 +364,18 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
return null;
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"))) {
Integer h = this.hAlignmentPane.getSelectedItem();
style = style.deriveHorizontalAlignment(h == null ? -1 : h);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical"))) {
Integer vAlign = this.vAlignmentPane.getSelectedItem();
if (vAlign != null) {
style = style.deriveVerticalAlignment(vAlign);
}
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Text_Style"))) {
if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[0])) {
style = style.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT);
} else if (ComparatorUtils.equals(this.textComboBox.getSelectedItem(), TEXT[1])) {
@ -394,7 +395,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private Style updateImageLayout(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Layout"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Image_Layout"))) {
if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[1])) {
style = style.deriveImageLayout(Constants.IMAGE_TILED);
} else if (ComparatorUtils.equals(this.imageLayoutComboBox.getSelectedItem(), LAYOUT[2])) {
@ -410,7 +411,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private Style updateTextRotation(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"))) {
if (this.textRotationComboBox.getSelectedIndex() != 0) {
style = style.deriveVerticalText(Style.VERTICALTEXT);
style = style.deriveRotation(0);
@ -424,21 +425,21 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
}
private Style updateOther(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Left_Indent"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Left_Indent"))) {
style = style.derivePaddingLeft(indentationUnitProcessor.paddingUnitGainFromSpinner((int) (this.leftIndentSpinner.getValue())));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Right_Indent"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Right_Indent"))) {
style = style.derivePaddingRight(indentationUnitProcessor.paddingUnitGainFromSpinner((int) (this.rightIndentSpinner.getValue())));
}
//间距
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_Before"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_Before"))) {
style = style.deriveSpacingBefore((int) (this.spaceBeforeSpinner.getValue()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_After"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Spacing_After"))) {
style = style.deriveSpacingAfter((int) (this.spaceAfterSpinner.getValue()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing"))) {
style = style.deriveLineSpacing((int) (this.lineSpaceSpinner.getValue()));
}
return style;

88
designer-base/src/main/java/com/fr/design/gui/style/TextFontTippedPane.java

@ -0,0 +1,88 @@
package com.fr.design.gui.style;
import com.fr.base.Style;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.widget.FRWidgetFactory;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/29
*/
public class TextFontTippedPane extends AbstractBasicStylePane {
private FRFontPane fontPane;
public TextFontTippedPane(boolean showFormatTip) {
this.initializePane(showFormatTip);
}
private void initializePane(boolean showFormatTip) {
setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
fontPane = new FRFontPane();
this.add(createLabeledPane(Toolkit.i18nText("Fine-Design_Form_FR_Font"), fontPane), BorderLayout.NORTH);
if (showFormatTip) {
JPanel formatTipPane = createFormatTipPane();
this.add(formatTipPane, BorderLayout.CENTER);
}
}
private JPanel createLabeledPane(String text, JPanel panel) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = { p };
double[] columnSize = {p, f};
UILabel uiLabel = new UILabel(text);
JPanel uiLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
uiLabelPane.add(uiLabel, BorderLayout.NORTH);
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[] { uiLabelPane, panel },
}, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
}
private JPanel createFormatTipPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
UILabel formatMigratedTip = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Format_Style_Migrated_Tip"));
formatMigratedTip.setForeground(new Color(153, 153, 153));
container.add(formatMigratedTip, BorderLayout.NORTH);
return container;
}
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
@Override
public void populateBean(Style style) {
this.fontPane.populateBean(style);
}
@Override
public Style update(Style style) {
return this.fontPane.update(style);
}
}

485
designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java

@ -0,0 +1,485 @@
package com.fr.design.gui.style;
import com.fr.base.CoreDecimalFormat;
import com.fr.base.GraphHelper;
import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.TextFontComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
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.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.math.RoundingMode;
import java.text.Format;
import java.text.SimpleDateFormat;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/29
* 包含格式相关的设置
*/
public class TextFormatPane extends AbstractBasicStylePane implements GlobalNameObserver {
private static final long serialVersionUID = 724330854437726751L;
private static final int LABEL_X = 4;
private static final int LABEL_Y = 18;
private static final int LABEL_DELTA_WIDTH = 8;
private static final int LABEL_HEIGHT = 15; //标签背景的范围
private static final int CURRENCY_FLAG_POINT = 6;
private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0, 30, 0, 0);
private static final Integer[] TYPES = new Integer[]{
FormatContents.NULL, FormatContents.NUMBER,
FormatContents.CURRENCY, FormatContents.PERCENT,
FormatContents.SCIENTIFIC, FormatContents.DATE,
FormatContents.TIME, FormatContents.TEXT};
private static final Integer[] DATE_TYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME};
private Format format;
private UIComboBox typeComboBox;
private TextFontComboBox textField;
private UILabel sampleLabel;
private JPanel contentPane;
private JPanel txtCenterPane;
private JPanel centerPane;
private JPanel optionPane;
private UICheckBox roundingBox;
private JPanel formatFontPane;
private boolean isRightFormat;
private boolean isDate = false;
private GlobalNameListener globalNameListener = null;
/**
* Constructor.
*/
public TextFormatPane() {
this.initComponents(TYPES);
}
protected UIComboBox getTypeComboBox() {
return typeComboBox;
}
protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4));
initSampleLabel();
contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 65);
}
};
typeComboBox = new UIComboBox(types);
UIComboBoxRenderer render = createComBoxRender();
typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener);
typeComboBox.setGlobalName("typeComboBox");
contentPane.add(sampleLabel, BorderLayout.NORTH);
txtCenterPane = new JPanel(new BorderLayout());
textField = new TextFontComboBox();
textField.addItemListener(textFieldItemListener);
textField.setEditable(true);
textField.setGlobalName("textField");
txtCenterPane.add(textField, BorderLayout.NORTH);
contentPane.add(txtCenterPane, BorderLayout.CENTER);
centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide");
centerPane.setPreferredSize(new Dimension(0, 0));
centerPane.add(contentPane, "show");
typeComboBox.setPreferredSize(new Dimension(155,20));
JPanel typePane = new JPanel(new BorderLayout());
typePane.add(typeComboBox, BorderLayout.CENTER);
typePane.setBorder(LEFT_BORDER);
// centerPane.setBorder(LEFT_BORDER);
JPanel option = new JPanel(new BorderLayout());
option.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"), SwingConstants.LEFT), BorderLayout.WEST);
roundingBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Base_Option_Half_Up"));
roundingBox.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0));
roundingBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
}
});
roundingBox.setGlobalName("roundingBox");
option.add(roundingBox, BorderLayout.CENTER);
optionPane = new JPanel(new CardLayout());
optionPane.add(new JPanel(), "hide");
optionPane.setPreferredSize(new Dimension(0, 0));
optionPane.add(option, "show");
Component[][] components = getComponent(centerPane, typePane);
this.add(createContentPane(components), BorderLayout.CENTER);
}
protected JPanel createContentPane (Component[][] components) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
}
protected Component[][] getComponent (JPanel centerPane, JPanel typePane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{centerPane, null},
new Component[]{optionPane, null},
};
}
protected UIComboBoxRenderer createComBoxRender() {
return new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Integer) {
label.setText(" " + FormatField.getInstance().getName((Integer) value));
}
return label;
}
};
}
private void initSampleLabel() {
Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4);
String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample");
Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR);
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) {
@Override
public void paint(Graphics g) {
super.paint(g);
int width = getWidth();
Color original = g.getColor();
g.setColor(getBackground());
g.fillRect(LABEL_X, LABEL_Y, width - LABEL_DELTA_WIDTH, LABEL_HEIGHT);
g.setColor(UIConstants.LINE_COLOR);
FontMetrics cellFM = g.getFontMetrics();
int textWidth = cellFM.stringWidth(getText());
GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26);
g.setColor(original);
}
};
sampleLabel.setHorizontalAlignment(UILabel.CENTER);
sampleLabel.setBorder(border);
}
@Override
/**
* 得到合适的大小
*/
public Dimension getPreferredSize() {
if (this.typeComboBox.getSelectedIndex() == FormatContents.NULL) {
return typeComboBox.getPreferredSize();
}
return super.getPreferredSize();
}
/**
* 弹出框标题
*
* @return 标题
*/
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
/**
* Populate
*/
public void populateBean(Format format) {
this.format = format;
if (format == null) {
this.typeComboBox.setSelectedIndex(FormatContents.NULL);
} else {
if (format instanceof CoreDecimalFormat) {
// check all value
String pattern = ((CoreDecimalFormat) format).toPattern();
if (isCurrencyFormatStyle(pattern)) {
setPatternComboBoxAndList(FormatContents.CURRENCY, pattern);
} else if (pattern.indexOf("%") > 0) {
setPatternComboBoxAndList(FormatContents.PERCENT, pattern);
this.roundingBox.setSelected(((CoreDecimalFormat) format).getRoundingMode().equals(RoundingMode.HALF_UP));
} else if (pattern.indexOf("E") > 0) {
setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern);
} else {
setPatternComboBoxAndList(FormatContents.NUMBER, pattern);
}
} else if (format instanceof SimpleDateFormat) { // date and time
String pattern = ((SimpleDateFormat) format).toPattern();
if (!isTimeType(pattern)) {
setPatternComboBoxAndList(FormatContents.DATE, pattern);
} else {
setPatternComboBoxAndList(FormatContents.TIME, pattern);
}
} else if (format instanceof TextFormat) { // Text
this.typeComboBox.setSelectedItem(FormatContents.TEXT);
}
}
}
private boolean isCurrencyFormatStyle(String pattern) {
if (pattern.length() == 0) {
return false;
}
if (pattern.charAt(0) == '¤' || pattern.charAt(0) == '$') {
return true;
}
return pattern.length() > CURRENCY_FLAG_POINT && pattern.startsWith("#,##0;");
}
/**
* 判断是否是数组有模式
*
* @param stringArray 字符串数组
* @param pattern 格式
* @return 是否是数组有模式
*/
public static int isArrayContainPattern(String[] stringArray, String pattern) {
for (int i = 0; i < stringArray.length; i++) {
if (ComparatorUtils.equals(stringArray[i], pattern)) {
return i;
}
}
return -1;
}
private void setPatternComboBoxAndList(int formatStyle, String pattern) {
this.typeComboBox.setSelectedItem(formatStyle);
this.textField.setSelectedItem(pattern);
}
private boolean isTimeType(String pattern) {
return pattern.matches(".*[Hhmsa].*");
}
/**
* update
*/
public Format update() {
String patternString = String.valueOf(textField.getSelectedItem());
if (getFormatContents() == FormatContents.TEXT) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString);
}
if (isRightFormat) {
if (StringUtils.isNotEmpty(patternString)) {
RoundingMode roundingMode = roundingBox.isSelected() ? RoundingMode.HALF_UP : RoundingMode.HALF_EVEN;
return FormatField.getInstance().getFormat(getFormatContents(), patternString, roundingMode);
}
}
return null;
}
private int getFormatContents() {
return (Integer) typeComboBox.getSelectedItem();
}
/**
* Refresh preview label.
*/
private void refreshPreviewLabel() {
this.sampleLabel.setText(FormatField.getInstance().getFormatValue());
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground"));
try {
isRightFormat = true;
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) {
return;
}
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem())));
} catch (Exception e) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(e.getMessage());
isRightFormat = false;
}
}
private boolean isTextOrNull() {
int contents = getFormatContents();
return contents == FormatContents.TEXT || contents == FormatContents.NULL;
}
/**
* Radio selection listener.
*/
ItemListener itemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
int contents = getFormatContents();
String[] items = FormatField.getInstance().getFormatArray(contents, false);
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (isTextOrNull()) {
centerPane.setPreferredSize(new Dimension(0, 0));
cardLayout.show(centerPane, "hide");
} else {
textField.removeAllItems();
textField.setItemArray(items);
textField.setSelectedIndex(0);
centerPane.setPreferredSize(new Dimension(270, 65));
cardLayout.show(centerPane, "show");
}
CardLayout optionLayout = ((CardLayout) optionPane.getLayout());
if (getFormatContents() == FormatContents.PERCENT) {
optionPane.setPreferredSize(new Dimension(100, 20));
optionLayout.show(optionPane, "show");
} else {
optionPane.setPreferredSize(new Dimension(0, 0));
optionLayout.show(optionPane, "hide");
roundingBox.setSelected(false);
}
}
}
};
ItemListener textFieldItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
refreshPreviewLabel();
}
}
};
@Override
/**
* populate
*/
public void populateBean(Style style) {
this.populateBean(style.getFormat());
}
@Override
/**
* update
*/
public Style update(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), "textField")
|| ComparatorUtils.equals(globalNameListener.getGlobalName(), "typeComboBox")
|| ComparatorUtils.equals(globalNameListener.getGlobalName(), "roundingBox")) {
return style.deriveFormat(this.update());
}
return style;
}
/**
* 默认只显示百分比的编辑下拉.
*/
public void justUsePercentFormat() {
typeComboBox.setEnabled(false);
this.typeComboBox.setSelectedItem(FormatContents.PERCENT);
}
public void setForDataSheet() {
Integer[] otherTypes = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC,};
this.typeComboBox = new UIComboBox(otherTypes);
UIComboBoxRenderer render = new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Integer) {
label.setText(" " + FormatField.getInstance().getName((Integer) value));
}
return label;
}
};
typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener);
setTypeComboBoxPane(typeComboBox);
}
protected void setTypeComboBoxPane (UIComboBox typeComboBox) {
this.add(typeComboBox, BorderLayout.NORTH);
}
public void setComboBoxModel(boolean isDate) {
if (this.isDate != isDate) {
this.isDate = isDate;
this.typeComboBox.setSelectedIndex(0);
if (isDate) {
for (int i = 0; i < DATE_TYPES.length; i++) {
this.typeComboBox.addItem(DATE_TYPES[i]);
}
for (int i = 0; i < TYPES.length; i++) {
this.typeComboBox.removeItemAt(1);
}
} else {
for (int i = 0; i < TYPES.length; i++) {
this.typeComboBox.addItem(TYPES[i]);
}
for (int i = 0; i < DATE_TYPES.length; i++) {
this.typeComboBox.removeItemAt(1);
}
}
}
}
@Override
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
public void registerChangeListener(UIObserverListener listener) {
typeComboBox.registerChangeListener(listener);
textField.registerChangeListener(listener);
}
@Override
public boolean shouldResponseNameListener() {
return false;
}
@Override
public void setGlobalName(String name) {
}
}

7
designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java

@ -299,15 +299,16 @@ public class TranslucentBorderSpecialPane extends AbstractBorderPackerPane imple
Background borderImage = style.getBorderImage();
if (borderImage instanceof ImageBackground) {
// 图片类型边框
Image image = ((ImageBackground) borderImage).getImage();
int[] ninePoint = ((ImageBackground) borderImage).getNinePoint();
ImageBackground imageBackground = (ImageBackground) borderImage;
Image image = imageBackground.getImage();
if (image != null) {
this.borderLineCombo.selectBorderImage();
this.imagePreviewPane.setImageWithSuffix(((ImageBackground) borderImage).getImageWithSuffix());
this.tweakNinePointButton.setEnabled(true);
this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity());
if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] > 0 && ninePoint[1] > 0 && ninePoint[2] > 0 && ninePoint[3] > 0) {
int[] ninePoint = ((ImageBackground) borderImage).getNinePoint();
if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] >= 0 && ninePoint[1] >= 0 && ninePoint[2] >= 0 && ninePoint[3] >= 0) {
this.ninePoint = Arrays.copyOf(ninePoint, 4);
} else {
this.ninePoint = new int[4];

18
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java

@ -50,7 +50,6 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
protected AutoCheckThemeNameTextField<T> nameTextField;
private UILabel nameErrorLabel;
protected ColorListPane colorListPane;
private ColorListExtendedPane colorListExtendedPane;
protected CellStyleListEditPane cellStyleSettingPane;
protected ChartStyleEditPane chartStyleSettingPane;
@ -117,16 +116,6 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
private JPanel createColorSchemeEditPane() {
colorListPane = new ColorListPane();
colorListExtendedPane = new ColorListExtendedPane();
colorListExtendedPane.setBackground(null);
colorListExtendedPane.setOpaque(false);
JPanel extendedBackgroundContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
extendedBackgroundContainer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
extendedBackgroundContainer.setBackground(Color.WHITE);
extendedBackgroundContainer.add(colorListExtendedPane, BorderLayout.WEST);
JPanel extendedContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
extendedContainer.add(extendedBackgroundContainer, BorderLayout.WEST);
double p = TableLayout.PREFERRED;
double[] rowSize = new double[]{p, p, p};
@ -135,16 +124,11 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
JPanel colorListContainerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorListContainerPane.add(colorListPane, BorderLayout.WEST);
JPanel previewLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewLabelPane.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Preview_Label")), BorderLayout.NORTH);
UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Edit_Tip"), new Color(153, 153, 153));
tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
JPanel content = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Edit_Label")), colorListContainerPane},
{null, tipLabel},
{previewLabelPane, extendedContainer},
},
rowSize, columnSize, 18, 7);
content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@ -174,7 +158,6 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
return container;
}
private void onColorSchemeChanged(List<Color> colors) {
colorListExtendedPane.populate(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
T theme = updateBean();
FineColorFlushUtils.replaceCacheObject(theme, replaceByColorScheme);
@ -242,7 +225,6 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
nameTextField.setText(name);
colorListPane.populate(theme.getColorScheme().getColors());
colorListExtendedPane.populate(colorListPane.update());
populateBean4CustomEditors(theme);
isPopulating = false;

4
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java

@ -12,7 +12,7 @@ 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.gui.style.TextFontTippedPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.ui.BorderUtils;
@ -94,7 +94,7 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
@Override
protected List<BasicPane> initPaneList() {
paneList = new ArrayList<>();
paneList.add(new FormatPane());
paneList.add(new TextFontTippedPane(false));
paneList.add(new BorderPane());
paneList.add(new AlignmentPane());
return paneList;

4
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/NoBorderPaneCellStyleEditPane.java

@ -2,7 +2,7 @@ package com.fr.design.mainframe.theme.edit.cell;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.style.AlignmentPane;
import com.fr.design.gui.style.FormatPane;
import com.fr.design.gui.style.TextFontTippedPane;
import java.util.ArrayList;
import java.util.List;
@ -12,7 +12,7 @@ public class NoBorderPaneCellStyleEditPane extends CellStyleEditPane {
@Override
protected List<BasicPane> initPaneList() {
paneList = new ArrayList<>();
paneList.add(new FormatPane());
paneList.add(new TextFontTippedPane(false));
paneList.add(new AlignmentPane());
return paneList;
}

27
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java

@ -31,6 +31,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
@ -99,7 +100,20 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
Utils.clipByRoundBorder(g2d, getWidth(), getHeight(), roundedBorder.getRoundedCorner(), roundedBorder.getThickness());
}
int titleHeight = titlePane == null ? 0 : titlePane.getHeight();
Border containerBorder = container.getBorder();
Insets insets = containerBorder.getBorderInsets(container);
int titleHeight = titlePane == null ? 0 : titlePane.getHeight() + insets.top;
//绘制标题背景
if (titlePane != null) {
Label data = titlePane.getData();
float opacity = data.getBackgroundOpacity();
Background background = data.getBackground();
if (background != null) {
Utils.paintBackground((Graphics2D) g, background, new Rectangle2D.Double(0, 0, getWidth(), titleHeight), opacity);
}
}
//绘制主体背景
Utils.paintBackground(g2d, style.getBackground(), new Rectangle2D.Double(0, titleHeight, getWidth(), getHeight() - titleHeight), style.getAlpha());
Utils.paintBackground(g2d, style.getBorderImage(), new Rectangle2D.Double(0, 0, getWidth(), getHeight()), style.getBorderImageOpacity());
@ -133,17 +147,14 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder()));
}
public Label getData(){
return data;
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Dimension size = getSize();
Background background = data.getBackground();
float opacity = data.getBackgroundOpacity();
if (background != null) {
Utils.paintBackground((Graphics2D) g, background, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()), opacity);
}
Graphics2D g2d = (Graphics2D) g.create();
Background inset = data.getInsetImage();
Image insetImage = inset instanceof ImageBackground ? ((ImageBackground) inset).getImage() : null;

3
designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java

@ -4,7 +4,6 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.fit.DesignerUIModeConfig;
import com.fr.design.fit.NewJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
@ -60,7 +59,7 @@ public class FormFitAttrAction extends JTemplateAction {
}
final FitProvider wbTpl = (FitProvider) jwb.getTarget();
ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane();
TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane(jwb);
showFitDialog(fitAttr, jwb, wbTpl, templateFitAttrPane);
}

10
designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java

@ -77,12 +77,12 @@ public class DesignerEditor<T extends JComponent> implements PropertyChangeListe
}
}
public void paintEditor(Graphics g, Dimension size, PaddingMargin margin) {
public void paintEditor(Graphics g, Dimension size, Insets margin) {
if (this.comp != null) {
int marginLeft = margin != null ? margin.getLeft() : 0;
int marginTop = margin != null ? margin.getTop() : 0;
int marginRight = margin != null ? margin.getRight() : 0;
int marginBottom = margin != null ? margin.getBottom() : 0;
int marginLeft = margin.left;
int marginTop = margin.top;
int marginRight = margin.right;
int marginBottom = margin.bottom;
int horizonMargin = marginLeft + marginRight;
int verticalMargin = marginTop + marginBottom;

29
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -40,6 +40,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
protected double backgroundOpacity4Painting; // 设计器预览界面中绘制组件背景图
protected Background borderImage4Painting; // 设计器预览界面中绘制边框图片
protected double borderImageOpacity4Painting;
protected Insets paddingInsets4Painting;
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) {
super(widget, initSize);
@ -87,6 +88,24 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
this.borderImageOpacity4Painting = opacity;
}
public void setPaddingInsets4Painting(PaddingMargin margin) {
if (this.paddingInsets4Painting == null) {
this.paddingInsets4Painting = new Insets(0, 0, 0, 0);
}
if (margin == null) {
this.paddingInsets4Painting.set(0, 0, 0, 0);
} else {
this.paddingInsets4Painting.set(margin.getTop(), margin.getLeft(), margin.getBottom(), margin.getRight());
}
}
protected Insets getPaddingInsets4Painting() {
if (this.paddingInsets4Painting == null) {
this.paddingInsets4Painting = new Insets(0, 0, 0, 0);
}
return this.paddingInsets4Painting;
}
/**
* 返回容器对应的widget
* @return 同上
@ -371,11 +390,13 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
*/
@Override
public Insets getInsets() {
PaddingMargin padding = toData().getMargin();
if (padding == null) {
return new Insets(0, 0, 0, 0);
Container parent = this.getParent();
if (parent instanceof XWTitleLayout && parent.getComponentCount() > 1) {
setPaddingInsets4Painting(null);
} else {
setPaddingInsets4Painting(toData().getMargin());
}
return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight());
return getPaddingInsets4Painting();
}
/**

8
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -230,7 +230,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override
public void paintForeground(Graphics2D g) {
Dimension size = getSize();
PaddingMargin margin = toData().getMargin();
Insets paddingInsets = getInsets();
if (!isEditing) {
// CHART-20568 & CHART-20627
@ -238,12 +238,12 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
// 同时这里又在下层绘制了一遍ChartComponent,导致图表进入编辑状态,会出现两个重叠的ChartComponent。
// 考虑到编辑中,FormDesigner中的ChartComponent位于上层,下层的ChartComponent实际上没什么用,所以可以不用绘制
// 下层的ChartComponent
designerEditor.paintEditor(g, size, margin);
designerEditor.paintEditor(g, size, paddingInsets);
}
if (coverPanel != null) {
int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0;
int verticalMargin = margin != null ? margin.getTop() + margin.getBottom() : 0;
int horizonMargin = paddingInsets.left + paddingInsets.right;
int verticalMargin = paddingInsets.top + paddingInsets.bottom;
coverPanel.setSize(size.width - horizonMargin, size.height - verticalMargin);
}
super.paintForeground(g);

2
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -275,7 +275,7 @@ public class XCreatorUtils {
try {
creator = Reflect.on(clazz).create(widget, d).get();
} catch (Exception ignore) {
FineLoggerFactory.getLogger().error(ignore.getMessage(), ignore);
}
if (creator == null) {
FineLoggerFactory.getLogger().error("Error to create xcreator!");

8
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -796,8 +796,6 @@ public class XWFitLayout extends XLayoutContainer {
layout.setContainerHeight(containerHeight);
layout.setContainerWidth(containerWidth);
addCompInterval(getAcualInterval());
LayoutUtils.layoutContainer(this);
// REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置
// 绝对布局内的组件尺寸调整需要在绝对布局的bound排除GAP后进行,否则计算出的
// 组件尺寸缩放比例会有问题
@ -888,7 +886,11 @@ public class XWFitLayout extends XLayoutContainer {
isRefreshing = true;
this.remove(oldCreator);
this.add(newCreator);
this.updateBoundsWidget();
//对于新增的绝对布局的组件,需要更新下内部组件的大小
if (newCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) newCreator).updateBoundsWidget();
newCreator.setBackupBound(newCreator.getBounds());
}
isRefreshing = false;
LayoutUtils.layoutContainer(this);
}

34
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -69,6 +69,19 @@ public class XWTitleLayout extends DedicateLayoutContainer {
setBackground4Painting(null, 0.0);
}
@Override
public Insets getInsets() {
if (getComponentCount() > 1) {
XCreator bodyCreator = getBodyCreator();
if (bodyCreator instanceof XBorderStyleWidgetCreator) {
XBorderStyleWidgetCreator styleBodyCreator = (XBorderStyleWidgetCreator) bodyCreator;
setPaddingInsets4Painting(styleBodyCreator.toData().getMargin());
return getPaddingInsets4Painting();
}
}
return super.getInsets();
}
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
@ -187,30 +200,37 @@ public class XWTitleLayout extends DedicateLayoutContainer {
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, (float) this.titleBackgroundOpacity4Painting));
XCreator titleCreator = getTitleCreator();
int titleHeight = titleCreator != null ? titleCreator.getHeight() : 0;
if (titleCreator != null) {
int height = titleCreator.getHeight();
Insets paddingInsets = getInsets();
Shape shape = new Rectangle2D.Double(0, 0, getWidth(), titleHeight);
Shape shape = new Rectangle2D.Double(0, 0, getWidth(), height + paddingInsets.top);
titleBackground4Painting.paint(g2d, shape);
g2d.setComposite(oldComposite);
}
}
}
private void paintBodyBackground(Graphics2D g2d) {
if (bodyBackground4Painting != null) {
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, (float) this.bodyBackgroundOpacity4Painting));
XCreator titleCreator = getTitleCreator();
int titleHeight = titleCreator != null ? titleCreator.getHeight() : 0;
// 兼容性考虑,组件样式背景不作用在标题范围内,只作用在控件整体,但同时不能遮挡作用于整体的边框图片
// 所以考虑样式背景与边框图片都由XWTitleLayout绘制,但样式背景要向下偏移标题栏的高度
Shape shape = new Rectangle2D.Double(0, titleHeight, getWidth(), getHeight() - titleHeight);
XCreator bodyCreator = getBodyCreator();
if (bodyCreator != null) {
int y = bodyCreator.getY();
int height = bodyCreator.getHeight();
Insets paddingInsets = getInsets();
Shape shape = new Rectangle2D.Double(0, y, getWidth(), height + paddingInsets.bottom);
bodyBackground4Painting.paint(g2d, shape);
g2d.setComposite(oldComposite);
}
}
}
/**
* 将WLayout转换为XLayoutContainer

13
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -62,10 +62,6 @@ public class XWCardLayout extends XLayoutContainer {
public static final String DEFAULT_NAME = "cardlayout";
//默认蓝色标题背景
private static final Color TITLE_COLOR = new Color(51, 132, 240);
public XWCardLayout(WCardLayout widget, Dimension initSize) {
super(widget, initSize);
}
@ -399,19 +395,10 @@ public class XWCardLayout extends XLayoutContainer {
@Override
public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
initBorderTitleStyle(style);
refreshBorderAndBackgroundStylePreviewEffect();
clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE));
}
private void initBorderTitleStyle(BorderPacker style) {
//初始化默认标题样式
style.setType(LayoutBorderStyle.TITLE);
style.setBorder(Constants.LINE_THIN);
TitlePacker widgetTitle = style.getTitle();
widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR));
}
//隐藏或显示标题部分
protected void clearOrShowTitleLayout(boolean isTitleStyle) {
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent();

12
designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java

@ -6,6 +6,7 @@ package com.fr.design.form.layout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import com.fr.form.ui.container.WLayout;
@ -123,15 +124,20 @@ public class FRTitleLayout implements FRLayoutManager, LayoutManager{
synchronized (target.getTreeLock()) {
int width = target.getWidth();
int height = target.getHeight();
int titleH = title==null ? 0 : WTitleLayout.TITLE_HEIGHT;
Insets insets = target.getInsets();
int titleH = title == null ? 0 : WTitleLayout.TITLE_HEIGHT;
insets = title == null ? new Insets(0, 0, 0, 0) : insets;
width = Math.max(0, width - insets.left - insets.right);
height = Math.max(0, height - insets.top - insets.bottom);
for (int i=0; i< target.getComponentCount(); i++) {
Component comp = target.getComponent(i);
if (comp != null) {
if (comp == title) {
comp.setBounds(0, 0, width, WTitleLayout.TITLE_HEIGHT);
comp.setBounds(insets.left, insets.top, width, WTitleLayout.TITLE_HEIGHT);
} else if (comp == body) {
int y = titleH + gap;
comp.setBounds(0, y, width, height-y);
comp.setBounds(insets.left, y + insets.top, width, height - y);
}
}
}

18
designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java

@ -3,13 +3,15 @@
*/
package com.fr.design.gui.xpane;
import com.fr.form.ui.LayoutBorderStyle;
import javax.swing.JPanel;
/**
* CardTagLayoutBorderPane Pane.
*/
public class CardTagLayoutStylePane extends LayoutStylePane {
private LayoutBorderStyle backupStyleFromPopulating = new LayoutBorderStyle();
@Override
protected JPanel createNamedTitleStylePane(boolean isRootLayout) {
@ -20,4 +22,18 @@ public class CardTagLayoutStylePane extends LayoutStylePane {
protected JPanel createNamedIntegralStylePane(boolean isRootLayout, boolean supportCornerRadius) {
return super.createNamedIntegralStylePane(isRootLayout, false);
}
@Override
public void populateBean(LayoutBorderStyle style) {
this.backupStyleFromPopulating = style;
super.populateBean(style);
}
@Override
public LayoutBorderStyle updateBean() {
LayoutBorderStyle style = super.updateBean();
style.setTitle(backupStyleFromPopulating.getTitle());
style.setType(backupStyleFromPopulating.getType());
return style;
}
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

@ -147,7 +147,7 @@ public class DownloadUtils {
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
HttpEntity entity = fileRes.getEntity();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent()));
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent(), StandardCharsets.UTF_8));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -151,7 +151,7 @@ public class CustomStylePane extends MultiTabPane<Style> {
@Override
protected List<BasicPane> initPaneList() {
paneList = new ArrayList<BasicPane>();
paneList.add(new FormatPane());
paneList.add(new TextFontTippedPane(true));
paneList.add(new BorderPane());
paneList.add(new AlignmentPane());
// paneList.add(new FRFontPane());

17
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -25,6 +25,7 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.Format;
import java.util.ArrayList;
import java.util.List;
@ -45,6 +46,8 @@ public class StylePane extends BasicPane implements UIObserver {
private final List<UIObserverListener> observerListeners = new ArrayList<>();
private Style backupStyleFromPopulating = Style.DEFAULT_STYLE;
public StylePane() {
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
customStylePane = new CustomStylePane();
@ -182,17 +185,21 @@ public class StylePane extends BasicPane implements UIObserver {
}
public Style updateBean() {
Style finalStyle = null;
if (getSelectedIndex() == 0) {
NameStyle nameStyle = themedCellStyleListPane.updateBean();
if (nameStyle != null) {
// 只有当前样式面板是跟随主题面板,且跟随主题面板中存在选中项,才使用该样式设置单元格
return nameStyle;
finalStyle = themedCellStyleListPane.updateBean();
}
if (finalStyle == null) {
finalStyle = customStylePane.updateBean();
}
return customStylePane.updateBean();
Format format = backupStyleFromPopulating.getFormat();
return finalStyle.deriveFormat(format);
}
public void populateBean(Style style) {
backupStyleFromPopulating = style;
if (style instanceof NameStyle) {
NameStyle nameStyle = (NameStyle) style;
setSelectedIndex(0);

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

@ -84,7 +84,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
return;
}
for (int i = 0; i < defaultListModel.getSize(); i++) {
if (ComparatorUtils.equals(ob, defaultListModel.get(i))) {
if (ComparatorUtils.equals(ob.getName(), defaultListModel.get(i).getName())) {
styleList.setSelectedIndex(i);
break;
}

4
designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java

@ -239,8 +239,12 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
radioButtons.get(1).setSelected(ob.getEngineState() == LayerReportAttr.LINE_ENGINE);
if (ob.getEngineState() == LayerReportAttr.ENGINE_X){
engineSettingPane.moveToFront(outEngineXSettingPane);
outEngineXSettingPane.setVisible(true);
outLineEngineSettingPane.setVisible(false);
}else {
engineSettingPane.moveToFront(outLineEngineSettingPane);
outEngineXSettingPane.setVisible(false);
outLineEngineSettingPane.setVisible(true);
}
countPerPageEditor.setValue(new Integer(ob.getCountPerPage()));
if (ob.isPageQuery()) {

83
designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

@ -67,7 +67,7 @@ public class ReportStylePane extends BasicPane {
private final CellStylePreviewPane previewArea;
private final UIButtonGroup<String> followingThemeButtonGroup;
private final CustomFloatStyleSettingPane customStylePane;
private final ThemedCellStyleListPane themedCellStyleListPane;
private final ThemedFloatStyleSettingPane themedFloatStyleSettingPane;
private final CardLayout cardLayout;
private final JComponent[] panes = new JComponent[2];
private final JPanel contentPane;
@ -79,7 +79,7 @@ public class ReportStylePane extends BasicPane {
previewArea = new CellStylePreviewPane();
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
customStylePane = new CustomFloatStyleSettingPane();
themedCellStyleListPane = new ThemedCellStyleListPane();
themedFloatStyleSettingPane = new ThemedFloatStyleSettingPane();
panes[0] = createThemedStylePane();
panes[1] = createCustomStylePane();
cardLayout = new CardLayout();
@ -87,7 +87,7 @@ public class ReportStylePane extends BasicPane {
initializePane();
themedCellStyleListPane.addChangeListener(new ChangeListener() {
themedFloatStyleSettingPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewArea();
@ -134,7 +134,7 @@ public class ReportStylePane extends BasicPane {
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]);
if (selectedIndex == 1) {
// 对于同一个单元格,跟随主题切换到自定义,自定义中的配置与其保持一致
NameStyle lastSelectedNameStyle = themedCellStyleListPane.updateBean();
NameStyle lastSelectedNameStyle = themedFloatStyleSettingPane.updateBean();
if (lastSelectedNameStyle != null) {
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle();
try {
@ -148,7 +148,7 @@ public class ReportStylePane extends BasicPane {
}
} else {
// 对于同一个单元格,自定义切换到跟随主题,跟随主题选中"默认"样式,并使用默认样式设置选中的单元格
themedCellStyleListPane.reset();
themedFloatStyleSettingPane.reset(customStylePane.updateBean());
}
}
});
@ -184,14 +184,7 @@ public class ReportStylePane extends BasicPane {
}
private JPanel createThemedStylePane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(createTitleBorder(Toolkit.i18nText("Fine-Design_Style_Selecting")));
themedCellStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(themedCellStyleListPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0));
scrollPane.setPreferredSize(new Dimension(620, scrollPane.getPreferredSize().height));
container.add(scrollPane, BorderLayout.CENTER);
return container;
return themedFloatStyleSettingPane;
}
private JPanel createCustomStylePane() {
@ -300,7 +293,7 @@ public class ReportStylePane extends BasicPane {
public Style updateBean() {
if (getSelectedIndex() == 0) {
NameStyle nameStyle = themedCellStyleListPane.updateBean();
NameStyle nameStyle = themedFloatStyleSettingPane.updateBean();
if (nameStyle != null) {
// 只有当前样式面板是跟随主题面板,且跟随主题面板中存在选中项,才使用该样式设置单元格
return nameStyle;
@ -313,7 +306,7 @@ public class ReportStylePane extends BasicPane {
if (style instanceof NameStyle) {
NameStyle nameStyle = (NameStyle) style;
setSelectedIndex(0);
themedCellStyleListPane.populateBean(nameStyle);
themedFloatStyleSettingPane.populateBean(nameStyle);
Style realStyle = nameStyle.getRealStyle();
try {
realStyle = (Style) realStyle.clone();
@ -531,6 +524,66 @@ public class ReportStylePane extends BasicPane {
}
}
private static class ThemedFloatStyleSettingPane extends BasicPane implements ChangeListener {
private final ThemedCellStyleListPane themedCellStyleListPane;
private final FormatPane formatPane;
private final List<ChangeListener> changeListeners = new ArrayList<>();
public ThemedFloatStyleSettingPane() {
UITabbedPane mainTabbedPane = new UITabbedPane();
setLayout(FRGUIPaneFactory.createBorderLayout());
themedCellStyleListPane = new ThemedCellStyleListPane();
themedCellStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(themedCellStyleListPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0));
scrollPane.setPreferredSize(new Dimension(620, scrollPane.getPreferredSize().height));
add(scrollPane, BorderLayout.CENTER);
mainTabbedPane.addTab(Toolkit.i18nText("Fine-Design_Style_Selecting"), scrollPane);
formatPane = new FormatPane();
mainTabbedPane.addTab(Toolkit.i18nText("Fine-Design_Chart_Format"), formatPane);
add(mainTabbedPane, BorderLayout.CENTER);
}
public void populateBean(NameStyle style) {
themedCellStyleListPane.populateBean(style);
formatPane.populate(style.getFormat());
}
public NameStyle updateBean() {
NameStyle style = themedCellStyleListPane.updateBean();
return (NameStyle) style.deriveFormat(formatPane.update());
}
public void reset(Style style) {
themedCellStyleListPane.reset();
formatPane.populate(style.getFormat());
}
@Override
protected String title4PopupWindow() {
return null;
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListeners.add(changeListener);
}
@Override
public void stateChanged(ChangeEvent e) {
for (ChangeListener changeListener: changeListeners) {
changeListener.stateChanged(e);
}
}
}
private Border createTitleBorder(String title) {
return new NoEdgeTitleBorder(
BorderFactory.createCompoundBorder(

52
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -14,6 +14,8 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIHeadGroup;
@ -23,6 +25,7 @@ import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.style.TextFormatPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -344,6 +347,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
* 自定义值显示
*/
private CustomValuePane valuePane;
/**
* 文本格式
*/
private FormatAttrPane formatAttrPane;
/**
* 横向可扩展性
*/
@ -400,6 +407,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
};
private AttributeChangeListener formatChangeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
formatAttrPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener heCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@ -570,6 +585,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
//自定义值显示
valuePane = new CustomValuePane();
// 文本格式
formatAttrPane = new FormatAttrPane();
//可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable")));
@ -612,6 +630,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
sortPane.addListener(sortPaneFormulaChangeListener, sortTypeBtnGroupChangeListener);
filterPane.addListener(filterPaneChangeListener);
valuePane.addListener(customValuePaneChangeListener);
formatAttrPane.addAttributeChangeListener(formatChangeListener);
heCheckBox.addChangeListener(heCheckBoxChangeListener);
veCheckBox.addChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.addActionListener(useMultiNumCheckBoxChangeListener);
@ -1212,6 +1231,39 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.formulaField.removeListener();
}
}
public class FormatAttrPane extends AbstractAttrNoScrollPane {
private final TextFormatPane formatPane;
public FormatAttrPane() {
this.formatPane = new TextFormatPane();
}
@Override
protected JPanel createContentPane() {
return formatPane;
}
protected void initContentPane() {
leftContentPane = createContentPane();
if (leftContentPane != null) {
leftContentPane.setBorder(BorderFactory.createEmptyBorder());
this.add(leftContentPane, BorderLayout.CENTER);
}
}
public void populate(CellElement cellElement) {
if (cellElement != null) {
formatPane.populateBean(cellElement.getStyle());
}
}
public void update(CellElement cellElement) {
if (cellElement != null) {
cellElement.setStyle(formatPane.update(cellElement.getStyle()));
}
}
}
}
@Override

55
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -3,7 +3,10 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.BaseFormula;
import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.gui.style.TextFormatPane;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.grid.GridKeyListener;
import com.fr.grid.selection.CellSelection;
@ -12,6 +15,7 @@ import com.fr.report.ReportHelper;
import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
@ -26,6 +30,7 @@ import java.awt.event.KeyEvent;
public class CellStringQuickEditor extends CellQuickEditor {
//文本域 直接可以自适应大小
private UITextArea stringTextArea;
private TextFormatPane formatPane;
//编辑状态
private boolean isEditing = false;
@ -87,10 +92,53 @@ public class CellStringQuickEditor extends CellQuickEditor {
}
}
});
content.add(stringTextArea, BorderLayout.CENTER);
content.add(stringTextArea, BorderLayout.NORTH);
content.add(createFormatPane(), BorderLayout.CENTER);
return content;
}
private JPanel createFormatPane() {
formatPane = new TextFormatPane();
AbstractAttrNoScrollPane container = new AbstractAttrNoScrollPane() {
@Override
protected JPanel createContentPane() {
return formatPane;
}
protected void initContentPane() {
leftContentPane = createContentPane();
if (leftContentPane != null) {
leftContentPane.setBorder(BorderFactory.createEmptyBorder());
this.add(leftContentPane, BorderLayout.CENTER);
}
}
};
container.addAttributeChangeListener(new AttributeChangeListener() {
@Override
public void attributeChange() {
isEditing = true;
CellSelection cs1 = (CellSelection) tc.getSelection();
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow());
if (cellElement == null) {
CellSelection cs = (CellSelection) tc.getSelection();
cellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow());
tc.getEditingElementCase().addCellElement(cellElement, false);
}
cellElement.setStyle(formatPane.update(cellElement.getStyle()));
fireTargetModified();
isEditing = false;
}
});
return container;
}
@Override
public boolean isScrollAll() {
return true;
@ -151,6 +199,11 @@ public class CellStringQuickEditor extends CellQuickEditor {
}
showText(str);
stringTextArea.setEditable(tc.isSelectedOneCell());
if (cellElement != null) {
Style style = cellElement.getStyle();
formatPane.populateBean(style);
}
}
/**

Loading…
Cancel
Save