Browse Source

REPORT-136212 fix: 图表创建面板优化

fbp/merge
Levy.Xie-解安森 5 months ago
parent
commit
8b440ef2dd
  1. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  2. 29
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

2
designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java

@ -24,7 +24,7 @@ import java.awt.Graphics2D;
* 图表的缩略图Icon, 在选择图表类型界面 用到. * 图表的缩略图Icon, 在选择图表类型界面 用到.
*/ */
public class ChartIcon implements Icon, XMLable { public class ChartIcon implements Icon, XMLable {
private static final int WIDTH = FineUIScale.scale(215); private static final int WIDTH = FineUIScale.scale(210);
private static final int HEIGHT = FineUIScale.scale(100); private static final int HEIGHT = FineUIScale.scale(100);

29
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -7,6 +7,7 @@ import com.fine.swing.ui.layout.Column;
import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
@ -24,7 +25,6 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JLayer; import javax.swing.JLayer;
@ -74,6 +74,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
JLayer<UIScrollPane> typeScrollPane = FineUIUtils.createCollapsibleScrollBarLayer(mainTypeList); JLayer<UIScrollPane> typeScrollPane = FineUIUtils.createCollapsibleScrollBarLayer(mainTypeList);
iconViewList = new JList(); iconViewList = new JList();
iconViewList.setBorder(null);
iconListModel = new DefaultListModel(); iconListModel = new DefaultListModel();
iconViewList.setModel(iconListModel); iconViewList.setModel(iconListModel);
@ -104,20 +105,20 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
ChartIcon chartIcon = (ChartIcon) value; ChartIcon chartIcon = (ChartIcon) value;
UILabel centerImg = new UILabel(chartIcon); UILabel centerImg = new UILabel(chartIcon);
UILabel text = new UILabel(getChartName(chartIcon), SwingConstants.CENTER); UILabel text = new UILabel(getChartName(chartIcon), SwingConstants.CENTER);
Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor") :
Column component = column( FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor");
fix(5), Color fillColor = FlatUIUtils.getUIColor("fill.normal", Color.WHITE);
cell(centerImg), cell(text),
fix(5)
).getComponent();
Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor")
: FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor");
UIRoundedBorder roundedBorder = new UIRoundedBorder(borderColor, 1, 5); UIRoundedBorder roundedBorder = new UIRoundedBorder(borderColor, 1, 5);
component.setBorder(BorderFactory.createCompoundBorder( Column component = column(
new ScaledEmptyBorder(0, 10, 10, 0), roundedBorder)); fix(5), cell(centerImg), cell(text), fix(5)
component.setBackground(Color.WHITE); ).with(it -> {
return component; it.setOpaque(true);
it.setBorder(roundedBorder);
it.setBackground(fillColor);
}).getComponent();
JPanel pane = FineLayoutBuilder.asBorderLayoutWrapped(component);
pane.setBorder(new ScaledEmptyBorder(0, 10, 10, 0));
return pane;
} }
return this; return this;
} }

Loading…
Cancel
Save