Browse Source

REPORT-113994 fix:修复一些代码质量问题

newui
lemon 6 months ago
parent
commit
2bcb8161a8
  1. 3
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  2. 46
      designer-base/src/main/java/com/fr/design/condition/FlowLayoutExample.java
  3. 4
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java
  5. 33
      designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java
  6. 6
      designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

3
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -1,6 +1,7 @@
package com.fr.design.condition;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
@ -54,7 +55,7 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
menuDef = new CellHighlightAddMenuDef();
menuDef.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Highlight_Click_to_Choose_Property_To_Modify"));
menuDef.setIconPath("com/fr/design/images/control/addPopup.png");
menuDef.setIcon(new LazyIcon("add_popup"));
toolbarDef.addShortCut(menuDef);

46
designer-base/src/main/java/com/fr/design/condition/FlowLayoutExample.java

@ -1,46 +0,0 @@
package com.fr.design.condition;
import javax.swing.*;
import java.awt.*;
public class FlowLayoutExample {
public static void main(String[] args) {
JFrame frame = new JFrame("FlowLayout Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 300);
// 创建一个主 JPanel 使用 BorderLayout
JPanel mainPanel = new JPanel(new BorderLayout());
// 创建一个居中面板 使用 FlowLayout 并设置为左对齐
JPanel rowPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
// 添加一些组件到 rowPanel
rowPanel.add(new JButton("Button 1"));
rowPanel.add(new JButton("Button 2"));
rowPanel.add(new JButton("Button 3"));
// 创建一个带有 GridBagLayout 的面板,用于垂直居中 rowPanel
JPanel centerPanel = new JPanel(new GridBagLayout());
// 设置 GridBagConstraints 以在垂直方向居中 rowPanel
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.anchor = GridBagConstraints.NORTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
centerPanel.add(rowPanel, gbc);
// 将居中面板添加到主面板的中间
mainPanel.add(centerPanel, BorderLayout.CENTER);
centerPanel.setBorder(BorderFactory.createMatteBorder(1,1,1,1, Color.black));
// 将主面板添加到 JFrame
frame.add(mainPanel);
frame.setVisible(true);
}
}

4
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java

@ -175,7 +175,9 @@ public class UITableEditorPane<T> extends BasicPane {
editTable.getTableHeader().setResizingAllowed(resizingAllowed);
}
/**
* 设置 TableHeader 文字左对齐
*/
public static class TableHeaderRenderer extends DefaultTableCellRenderer {
public TableHeaderRenderer() {
setHorizontalAlignment(SwingConstants.LEFT);

4
designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java

@ -30,7 +30,9 @@ import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.*;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
/**
* Image background pane.

33
designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java

@ -151,6 +151,16 @@ public class HeaderFooterEditPane extends JPanel {
//toolbar.
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
printBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportGUI_Print_Background"));
headerUnitFieldPane = new AdjustHeightPane();
footerUnitFieldPane = new AdjustHeightPane();
headFootUnitFieldPane = new AdjustHeightPane();
initIconToolPanel();
toolbar.add(iconToolPanel);
return toolbar;
}
private UIButton initCustomBackgroundButton() {
UIButton customBackgroundButton = new UIButton();
customBackgroundButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"));
customBackgroundButton.set4ToolbarButton();
@ -171,23 +181,10 @@ public class HeaderFooterEditPane extends JPanel {
backgroundDialog.setVisible(true);
}
});
printBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportGUI_Print_Background"));
JPanel headerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
headerUnitFieldPane = new AdjustHeightPane();
headerPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Header") + ":"));
headerPane.add(headerUnitFieldPane);
JPanel footerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
footerUnitFieldPane = new AdjustHeightPane();
footerPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Footer") + ":"));
footerPane.add(footerUnitFieldPane);
JPanel headerFooterPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
headFootUnitFieldPane = new AdjustHeightPane();
headerFooterPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height") + ":"));
headerFooterPane.add(headFootUnitFieldPane);
return customBackgroundButton;
}
private void initIconToolPanel() {
iconToolPanel = row(
6,
cell(this.createHFInsertButton(new TextHFElement())),
@ -198,15 +195,13 @@ public class HeaderFooterEditPane extends JPanel {
cell(this.createHFInsertButton(new TimeHFElement())),
cell(this.createHFInsertButton(new ImageHFElement())),
cell(this.createHFInsertButton(new NewLineHFElement())),
cell(customBackgroundButton),
cell(initCustomBackgroundButton()),
cell(printBackgroundCheckBox),
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height") + ":")),
cell(headFootUnitFieldPane)
).with(it -> it.setBorder(new ScaledEmptyBorder(2,0,2,0)))
).getComponent();
toolbar.add(iconToolPanel);
return toolbar;
}
/**

6
designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -25,7 +25,11 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.*;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle;
/**

Loading…
Cancel
Save