Browse Source

Merge pull request #14941 in DESIGN/design from fbp/release to fbp/feature

* commit 'a3c89b079cb33738ab8dd4dad5e15743ae83ceea':
  REPORT-135996 fix: 视觉二次验收问题修复
  REPORT-136212 fix: 图表创建面板优化
fbp/feature
superman 2 months ago
parent
commit
9837879b7e
  1. 30
      designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java
  2. 16
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  3. 19
      designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java
  4. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  5. 29
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

30
designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java

@ -1,12 +1,22 @@
package com.fine.theme.utils; package com.fine.theme.utils;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.core.FormatField;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.Color;
import static com.fine.swing.ui.layout.Layouts.cell; 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.flex;
@ -62,4 +72,24 @@ public class FineComponentsFactory {
flex(), cell(confirmButton), cell(cancelButton)).getComponent(); flex(), cell(confirmButton), cell(cancelButton)).getComponent();
} }
/**
* 创建示例文本圆角边框&浅灰背景
*
* @return 示例文本Label
*/
public static UILabel createSampleLabel() {
Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption");
Border interBorder = new UIRoundedBorder(labelColor, 0, 4);
Border border = BorderFactory.createTitledBorder(interBorder, Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"),
TitledBorder.ABOVE_TOP, 0, null, labelColor);
UILabel sampleLabel = new UILabel(FormatField.getInstance().getFormatValue());
sampleLabel.setHorizontalAlignment(UILabel.CENTER);
sampleLabel.setBorder(BorderFactory.createCompoundBorder(border, new ScaledEmptyBorder(2, 0, 8, 0)));
FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP);
return sampleLabel;
}
} }

16
designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java

@ -1,9 +1,9 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
@ -12,8 +12,6 @@ import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.gui.icombobox.TextFontComboBox; import com.fr.design.gui.icombobox.TextFontComboBox;
@ -28,13 +26,10 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.math.RoundingMode; import java.math.RoundingMode;
import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.text.Format; import java.text.Format;
@ -161,14 +156,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
} }
private void initSampleLabel() { private void initSampleLabel() {
Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); sampleLabel = FineComponentsFactory.createSampleLabel();
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, labelColor);
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue());
sampleLabel.setHorizontalAlignment(UILabel.CENTER);
sampleLabel.setBorder(border);
FineUIStyle.setStyle(sampleLabel, FineUIStyle.LABEL_TIP);
} }

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

@ -1,15 +1,13 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.data.core.FormatField; import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents; import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -22,17 +20,11 @@ import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.math.RoundingMode; import java.math.RoundingMode;
@ -112,14 +104,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
} }
private void initPreviewLabel4GeneralFormat() { private void initPreviewLabel4GeneralFormat() {
Color labelColor = FineUIUtils.getUIColor("Label.tipColor", "inactiveCaption"); previewLabel = FineComponentsFactory.createSampleLabel();
Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 0, 4);
String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample");
Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.ABOVE_TOP, 0, null, labelColor);
previewLabel = new UILabel(FormatField.getInstance().getFormatValue());
previewLabel.setHorizontalAlignment(UILabel.CENTER);
previewLabel.setBorder(border);
FineUIStyle.setStyle(previewLabel, FineUIStyle.LABEL_TIP);
} }
protected void initLayout() { protected void initLayout() {

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