Browse Source

Merge remote-tracking branch 'origin/fbp/release' into fbp/release

fbp/merge
Destiny.Lin 4 months ago
parent
commit
ae095af084
  1. 15
      designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java
  2. 29
      designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java
  3. 5
      designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java
  4. 4
      designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java
  5. 18
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateDirTreeSearchPane.java
  6. 36
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java
  7. 2
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  8. 6
      designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java
  9. 24
      designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTestHelper.java
  10. 5
      designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java
  11. 16
      designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java
  12. 2
      designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java
  13. 34
      designer-base/src/test/java/com/fr/design/ui/Model.java
  14. 75
      designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java
  15. 4
      designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java
  16. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPaneWithGradientBar.java
  17. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  18. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  19. 12
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieCategoryLabelDetailPane.java
  20. 15
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeBeautyPane.java
  21. 5
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

15
designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java

@ -4,8 +4,8 @@ import com.fine.swing.ui.layout.Column;
import com.fine.swing.ui.layout.Layouts;
import com.fine.swing.ui.layout.Row;
import com.fine.swing.ui.layout.Spacer;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.collections.combination.Pair;
@ -75,7 +75,7 @@ public class FineLayoutBuilder {
Row row = new Row();
List<Component> visibleComponents = Arrays.stream(componentArray)
.filter(com -> com != null && com.isVisible()).collect(Collectors.toList());
if (visibleComponents.size() >= 1) {
if (!visibleComponents.isEmpty()) {
// 仅当存在可见组件时处理布局
dealWithVisibleComponents(weight, column, componentArray, row, visibleComponents);
}
@ -87,6 +87,17 @@ public class FineLayoutBuilder {
return new JPanel();
}
/**
* 典型的左右网格布局竖向间距为典型间距标签及组件比例采用典型比例
*
* @param components 组件两列多行
* @return 面板
*/
public static JPanel commonLeftRightLayout(Component[][] components) {
return compatibleTableLayout(LayoutConstants.VERTICAL_GAP, components,
new double[]{LayoutConstants.LEFT_WEIGHT, LayoutConstants.RIGHT_WEIGHT});
}
private static void dealWithVisibleComponents(double[] weight, Column column, Component[] value, Row row, List<Component> components) {
if (components.size() == 1 && value[0] != null) {
// 仅存在首个元素,则该元素自适应占满整行

29
designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java

@ -1,8 +1,8 @@
package com.fr.design.file;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.file.DelFileAction;
@ -33,7 +33,6 @@ import com.fr.stable.StringUtils;
import com.fr.stable.collections.CollectionUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@ -42,15 +41,11 @@ import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION;
@ -380,28 +375,16 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
// 确认按钮,默认就可用
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm"));
FineUIStyle.setStyle(confirmButton, FineUIStyle.STYLE_PRIMARY);
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
confirmClose();
}
});
confirmButton.addActionListener(e -> confirmClose());
confirmButton.setEnabled(true);
// 取消按钮
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
cancelButton.addActionListener(e -> dispose());
this.add(row(8, flex(), cell(confirmButton), cell(cancelButton))
.with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 10))).getComponent(), BorderLayout.SOUTH);
JPanel buttonPane = FineComponentsFactory.createConfirmCancelButtonPane(confirmButton, cancelButton);
buttonPane.setBorder(new ScaledEmptyBorder(0, 10, 10, 10));
this.add(buttonPane, BorderLayout.SOUTH);
this.setSize(FineUIScale.scale(new Dimension(660, 600)));
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Move"));

5
designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java

@ -1,6 +1,7 @@
package com.fr.design.file;
import com.fr.base.FRContext;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.gui.itree.filetree.TemplateDirTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
@ -11,11 +12,9 @@ import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Color;
/**
* 目录树面板
@ -35,7 +34,7 @@ public class TemplateDirTreePane extends JPanel {
public TemplateDirTreePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createLineBorder(Color.gray));
this.setBorder(FineBorderFactory.createWrappedRoundBorder());
templateDirTree = new TemplateDirTree();
remindPane = new TemplateDirSearchRemindPane(getTemplateDirTree());

4
designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java

@ -17,7 +17,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
@ -65,6 +64,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende
add(_checkBox, BorderLayout.WEST);
JPanel gapPanel = new JPanel();
gapPanel.setPreferredSize(FineUIScale.scale(new Dimension(4, 20)));
gapPanel.setOpaque(false);
add(gapPanel, BorderLayout.CENTER);
_actualTreeRenderer = renderer;
}
@ -80,7 +80,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
_checkBox.setPreferredSize(FineUIScale.scale(new Dimension(PROTOTYPE.getPreferredSize().width, 0)));
setComponentOrientation(tree.getComponentOrientation());
setOpaque(false);
TreePath path = tree.getPathForRow(row);
handleCheckBox(tree, path);

18
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateDirTreeSearchPane.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe.manager.search.searcher.control.pane;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.data.datapane.management.search.pane.FineSearchPane;
import com.fr.design.file.TemplateDirTreePane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.manager.search.TemplateDirTreeSearchManager;
@ -10,15 +10,10 @@ import com.fr.design.search.event.TreeSearchStatusChangeEvent;
import com.fr.design.search.event.TreeSearchStatusChangeListener;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
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.Insets;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@ -29,11 +24,6 @@ import java.awt.event.MouseEvent;
*/
public class TemplateDirTreeSearchPane extends JPanel implements TreeSearchStatusChangeListener {
/**
* 搜索输入框
*/
private UITextField searchTextField;
/**
* 搜索面板
*/
@ -43,14 +33,14 @@ public class TemplateDirTreeSearchPane extends JPanel implements TreeSearchStatu
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
TemplateDirTreeSearchManager.getInstance().startSearch(searchTextField.getText());
TemplateDirTreeSearchManager.getInstance().startSearch(searchPane.getText());
}
}
};
public TemplateDirTreeSearchPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 15, 0, 10));
this.setBorder(new ScaledEmptyBorder(10, 10, 0, 10));
initSearchPane();
add(searchPane, BorderLayout.CENTER);
TemplateDirTreeSearchManager.getInstance().registerTreeSearchStatusChangeListener(this);
@ -94,7 +84,7 @@ public class TemplateDirTreeSearchPane extends JPanel implements TreeSearchStatu
}
private void dealWithTextChange() {
if (StringUtils.isEmpty(searchTextField.getText()) && TemplateDirTreeSearchManager.getInstance().isInSearchMode()) {
if (StringUtils.isEmpty(searchPane.getText()) && TemplateDirTreeSearchManager.getInstance().isInSearchMode()) {
// 如果是搜索模式下,看作是用户删除输入框文字,仅复原TemplateTreePane
TemplateDirTreeSearchManager.getInstance().restoreTreePane();
TemplateDirTreePane.getInstance().refreshDockingView();

36
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java

@ -1,5 +1,11 @@
package com.fr.design.mainframe.vcs.ui;
import com.fine.swing.ui.layout.Column;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -10,7 +16,6 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
@ -19,7 +24,7 @@ import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -47,7 +52,7 @@ public class EditFileVersionDialog extends UIDialog {
initComponents();
setModal(true);
setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Save_Version"));
setSize(300, 220);
setSize(FineUIScale.scale(new Dimension(300, 220)));
setResizable(false);
GUICoreUtils.centerWindow(this);
@ -55,15 +60,20 @@ public class EditFileVersionDialog extends UIDialog {
private void initComponents() {
Column centerColumn = new Column();
centerColumn.setSpacing(10);
add(centerColumn, BorderLayout.CENTER);
JPanel fontPane = new JPanel(new BorderLayout());
UILabel fontLabel = new UILabel(" " + Toolkit.i18nText("Fine-Design_Vcs_Version_Message") + ":");
UILabel fontLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Version_Message"));
fontLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Message"));
fontPane.add(fontLabel, BorderLayout.NORTH);
msgTestArea.setBorder(null);
UIScrollPane scrollPane = new UIScrollPane(msgTestArea);
UILabel versionTip = new UILabel(" " + Toolkit.i18nText("Fine-Design_Vcs_Version_Number") + ":");
JPanel scrollPane = FineLayoutBuilder.asBorderLayoutWrapped(new UIScrollPane(msgTestArea));
scrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
UILabel versionTip = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Version_Number"));
versionTip.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_Version_Number"));
Component[][] components = new Component[][]{
new Component[]{versionTip, versionLabel},
@ -72,16 +82,16 @@ public class EditFileVersionDialog extends UIDialog {
double[] rowSizes = new double[]{25, 100};
double[] columnSizes = new double[]{70, 200};
add(TableLayoutHelper.createTableLayoutPane(components, rowSizes, columnSizes), BorderLayout.CENTER);
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
add(buttonPane, BorderLayout.SOUTH);
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSizes, columnSizes);
UIButton ok = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK"));
UIButton cancel = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Design_Action_Cancel"));
JPanel buttonPane = FineComponentsFactory.createConfirmCancelButtonPane(ok, cancel);
centerColumn.add(pane);
centerColumn.add(buttonPane);
centerColumn.setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
buttonPane.add(ok);
buttonPane.add(cancel);
ok.addActionListener(new ActionListener() {
@Override

2
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -1128,7 +1128,7 @@ Tree.selectionInactiveBackground = @selectionBackground
Tree.selectionInactiveForeground = @selectionForeground
Tree.textBackground = $Tree.background
Tree.textForeground = $Tree.foreground
Tree.selectionBorderColor = @cellFocusColor
Tree.selectionBorderColor = #00000000
Tree.dropCellBackground = @dropCellBackground
Tree.dropCellForeground = @dropCellForeground
Tree.dropLineColor = @dropLineColor

6
designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java

@ -51,9 +51,9 @@ public class DesignTableDataManagerTest {
EasyMock.expect(TableDataConfig.getInstance()).andReturn(config).once().andReturn(config2).once();
PowerMock.mockStatic(TableDataFactory.class);
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config))
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData())
.andReturn(new String[]{"firstData", "secondData"}).once();
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config2))
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData())
.andReturn(new String[]{"firstData", "secondData"}).once();
@ -119,7 +119,7 @@ public class DesignTableDataManagerTest {
EasyMock.expect(dataSource.getTableData("ds2")).andReturn(td2).anyTimes();
EasyMock.expect(TableDataConfig.getInstance()).andReturn(config).anyTimes();
PowerMock.mockStatic(TableDataFactory.class);
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config))
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData())
.andReturn(new String[]{"ds1", "ds2"}).anyTimes();
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfTemplateData(dataSource))
.andReturn(new String[]{"ds1", "ds2"});

24
designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTestHelper.java

@ -1,12 +1,7 @@
package com.fr.design.mainframe.template.info;
import com.fr.config.BBSAttr;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject;
import org.easymock.EasyMock;
import org.powermock.api.easymock.PowerMock;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@ -31,23 +26,4 @@ class TemplateInfoTestHelper {
field.set(null, newValue);
}
static void setUpMockForNewInstance() throws Exception {
MarketConfig mockMarketConfig = EasyMock.mock(MarketConfig.class);
BBSAttr bbsAttr = EasyMock.mock(BBSAttr.class);
EasyMock.expect(bbsAttr.getBbsUid()).andReturn(71113).anyTimes();
EasyMock.expect(mockMarketConfig.getBBSAttr()).andReturn(bbsAttr).anyTimes();
PowerMock.mockStatic(MarketConfig.class);
EasyMock.expect(MarketConfig.getInstance()).andReturn(mockMarketConfig).anyTimes();
PowerMock.mockStatic(DesignerEnvManager.class);
DesignerEnvManager envManager = EasyMock.mock( DesignerEnvManager.class);
EasyMock.expect(envManager.getUUID()).andReturn("6b6699ff-ec63-43b0-9deb-b580a5f10411").anyTimes();
EasyMock.expect(envManager.isJoinProductImprove()).andReturn(true).anyTimes();
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(envManager).anyTimes();
EasyMock.replay(mockMarketConfig, bbsAttr, envManager);
PowerMock.replayAll();
}
}

5
designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java

@ -9,9 +9,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.notification.SnapChatConfig;
import com.fr.stable.xml.XMLableReader;
import com.fr.store.StateHubManager;
import com.fr.store.impl.MemoryLock;
import com.fr.store.impl.MemoryStore;
import com.fr.transaction.Configurations;
import com.fr.transaction.LocalConfigurationHelper;
import org.easymock.EasyMock;
@ -41,8 +38,6 @@ public class SnapChatMenuDefTest {
DaoContext.setXmlEntityDao(new LocalXmlEntityDao());
DaoContext.setClassHelperDao(new LocalClassHelperDao());
DaoContext.setEntityDao(new LocalEntityDao());
StateHubManager.setLock(new MemoryLock());
StateHubManager.setStorage(new MemoryStore());
Configurations.setHelper(new LocalConfigurationHelper());
}

16
designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java

@ -1,16 +1,13 @@
package com.fr.design.os.impl;
import com.fr.general.GeneralContext;
import com.fr.third.org.apache.commons.math3.analysis.function.Pow;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import java.util.Locale;
/**
* @author hades
@ -27,13 +24,4 @@ public class SupportOSImplTest extends TestCase {
Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support());
}
@Test
public void testGetMacOsVersion() throws Exception {
String backUp = System.getProperty("os.version");
System.setProperty("os.version", "10.16");
int number = Whitebox.invokeMethod(SupportOSImpl.MACOS_WEB_PLUGIN_MANAGEMENT, "getMacOsVersion");
Assert.assertEquals(16, number);
System.setProperty("os.version", backUp);
}
}

2
designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java

@ -20,7 +20,7 @@ public class FineUIDemo {
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final JxUIPane<ModernUIPaneTest.Model> pane = new JxUIPane.Builder<ModernUIPaneTest.Model>()
final JxUIPane<Model> pane = new JxUIPane.Builder<Model>()
.withComponent(StartComponent.KEY).build();
contentPane.add(pane, BorderLayout.CENTER);
frame.setVisible(true);

34
designer-base/src/test/java/com/fr/design/ui/Model.java

@ -0,0 +1,34 @@
package com.fr.design.ui;
/**
* 测试用
*
* @author vito
* @since 11.0
* Created on 2024/9/11
*/
public class Model {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public void print(String message) {
System.out.println(message);
}
}

75
designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java

@ -1,75 +0,0 @@
package com.fr.design.ui;
import com.fr.design.DesignerEnvManager;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-05
*/
public class ModernUIPaneTest {
public static void main(String... args) {
final JFrame frame = new JFrame();
frame.setSize(1200, 800);
JPanel contentPane = (JPanel) frame.getContentPane();
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final ModernUIPane<Model> pane = new ModernUIPane.Builder<Model>()
.withEMB("/com/fr/design/ui/demo.html").namespace("Pool").build();
contentPane.add(pane, BorderLayout.CENTER);
Model model = new Model();
model.setAge(20);
model.setName("Pick");
pane.populate(model);
JPanel panel = new JPanel(new FlowLayout());
contentPane.add(panel, BorderLayout.SOUTH);
JButton button = new JButton("点击我可以看到Swing的弹框,输出填写的信息");
panel.add(button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Model returnValue = pane.update();
if (returnValue != null) {
JOptionPane.showMessageDialog(frame, String.format("姓名为:%s,年龄为:%d", returnValue.getName(), returnValue.getAge()));
}
}
});
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
public static class Model {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public void print(String message) {
System.out.println(message);
}
}
}

4
designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java

@ -2,7 +2,7 @@ package com.fr.design.ui.report;
import com.fr.design.DesignerEnvManager;
import com.fr.design.jxbrowser.JxUIPane;
import com.fr.design.ui.ModernUIPaneTest;
import com.fr.design.ui.Model;
import javax.swing.JFrame;
import javax.swing.JPanel;
@ -21,7 +21,7 @@ public class TemplateWebSettingDemo {
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final JxUIPane<ModernUIPaneTest.Model> pane = new JxUIPane.Builder<ModernUIPaneTest.Model>()
final JxUIPane<Model> pane = new JxUIPane.Builder<Model>()
.withComponent(TemplateWebSettingComponent.KEY).build();
contentPane.add(pane, BorderLayout.CENTER);
frame.setVisible(true);

14
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPaneWithGradientBar.java

@ -1,11 +1,11 @@
package com.fr.van.chart.designer.component;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.chart.base.GradientStyle;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.plugin.chart.type.GradientType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -29,18 +29,12 @@ public class VanChartBeautyPaneWithGradientBar extends VanChartBeautyPane {
private JPanel initGradientBarPane() {
colorGradient = new FixedGradientBar(4, 140);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{null, colorGradient},
};
gradientBarPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
gradientBarPane = FineLayoutBuilder.commonLeftRightLayout(components);
gradientBarPane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0));
return gradientBarPane;
}

5
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
@ -69,7 +70,7 @@ public class VanChartHtmlLabelPane extends JPanel {
JPanel contentPane = FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1});
this.setLayout(new BorderLayout());
this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
this.add(contentPane, BorderLayout.NORTH);
if (widthAndHeightPane != null) {
this.add(widthAndHeightPane, BorderLayout.CENTER);
@ -150,7 +151,7 @@ public class VanChartHtmlLabelPane extends JPanel {
new Component[]{isCustomWidth, customWidth},
new Component[]{isCustomHeight, customHeight},
};
return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3});
return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 1});
}
private void checkWidth() {

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -22,7 +22,6 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -62,7 +61,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
initStyleListener();
return FineLayoutBuilder.compatibleTableLayout(10, getLabelStyleComponents(plot),new double[]{1.2, 3});
return FineLayoutBuilder.commonLeftRightLayout(getLabelStyleComponents(plot));
}
protected void initStyleListener() {
@ -118,7 +117,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createGapTableLayoutPane(title, panel);
return FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, new UILabel(title), panel);
}
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {

12
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieCategoryLabelDetailPane.java

@ -1,13 +1,11 @@
package com.fr.van.chart.designer.style.label;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
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.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.pie.style.VanChartPieCategoryLabelContentPane;
@ -40,18 +38,12 @@ public class VanChartPieCategoryLabelDetailPane extends VanChartPlotLabelDetailP
UIButtonGroup<Integer> position = new UIButtonGroup<>(positionName, positionValue);
setPosition(position);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = {p, p};
double[] col = {f, e};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), position},
};
return TableLayoutHelper.createTableLayoutPane(components, row, col);
return FineLayoutBuilder.commonLeftRightLayout(components);
}
protected void checkPositionPane(String title) {

15
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeBeautyPane.java

@ -1,15 +1,14 @@
package com.fr.van.chart.gauge;
import com.fine.theme.utils.FineLayoutBuilder;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.GradientStyle;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.plugin.chart.type.GradientType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
@ -29,24 +28,18 @@ public class VanChartGaugeBeautyPane extends VanChartBeautyPane {
public VanChartGaugeBeautyPane() {
super();
this.add(initGradientBarPane(), BorderLayout.SOUTH);
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
initListener();
}
private JPanel initGradientBarPane() {
colorGradient = new FixedGradientBar(4, 140);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{null, colorGradient},
};
gradientBarPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
gradientBarPane = FineLayoutBuilder.commonLeftRightLayout(components);
gradientBarPane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0));
colorGradient.updateColor(ChartConstants.GRADIENT_END, ChartConstants.GRADIENT_START);
return gradientBarPane;
}

5
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -27,7 +27,6 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.plugin.chart.type.GradientType;
import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFillStylePane;
import com.fr.van.chart.designer.style.series.VanChartMultiColorSeriesPane;
@ -172,7 +171,7 @@ public class VanChartGaugeSeriesPane extends VanChartMultiColorSeriesPane {
}
}
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(title, gaugeLayout);
JPanel panel = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, new UILabel(title), gaugeLayout);
gaugeLayout.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@ -211,7 +210,7 @@ public class VanChartGaugeSeriesPane extends VanChartMultiColorSeriesPane {
private JPanel createGaugeStylePane() {
JPanel panel = new JPanel(new BorderLayout(0, FineUIScale.scale(10)));
JPanel centerPanel = FineLayoutBuilder.compatibleTableLayout(10, getDiffComponentsWithGaugeStyle(), new double[]{1.2, 3});
JPanel centerPanel = FineLayoutBuilder.commonLeftRightLayout(getDiffComponentsWithGaugeStyle());
panel.add(centerPanel, BorderLayout.CENTER);
if (rotate != null) {
JPanel panel1 = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3},

Loading…
Cancel
Save