Browse Source

REPORT-138445 fix: 优化文本域UI问题

fbp/master
Levy.Xie-解安森 2 months ago
parent
commit
de64bbf7a1
  1. 23
      designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java
  2. 9
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java
  3. 9
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java

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

@ -3,20 +3,19 @@ package com.fine.theme.utils;
import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.core.FormatField;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.Constants;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.Color;
import java.awt.*;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.flex;
@ -92,4 +91,18 @@ public class FineComponentsFactory {
return sampleLabel;
}
/**
* 创建一个固定高度可上下滚动的文本域面板
* @param textArea 文本域
* @param height 高度
* @return 滚动面板
*/
public static JScrollPane createFixHeightTextArea(UITextArea textArea, int height) {
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(scrollPane.getPreferredSize().width, height));
scrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
textArea.setBorder(null);
return scrollPane;
}
}

9
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java

@ -1,5 +1,6 @@
package com.fr.van.chart.map.designer.type;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
@ -9,6 +10,8 @@ import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import static com.fine.theme.utils.FineUIScale.scale;
/**
* @author Bjorn
* @version 10.0
@ -24,8 +27,10 @@ public class TileLayerPane extends JPanel {
customTileLayer = new UITextArea();
attribution = new UITextArea();
Component[][] comps = new Component[][]{
new Component[]{new UILabel("url"), customTileLayer},
new Component[]{new UILabel("Attribution"), attribution}
new Component[]{new UILabel("url"),
FineComponentsFactory.createFixHeightTextArea(customTileLayer, scale(36))},
new Component[]{new UILabel("Attribution"),
FineComponentsFactory.createFixHeightTextArea(attribution, scale(36))}
};
JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 3});

9
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.map.designer.type;
import com.fine.theme.utils.FineComponentsFactory;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.decision.webservice.v10.map.MapEditService;
import com.fr.design.dialog.FineJOptionPane;
@ -28,6 +29,8 @@ import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import static com.fine.theme.utils.FineUIScale.scale;
/**
* @author Bjorn
* @version 10.0
@ -61,9 +64,11 @@ public class WMSLayerPane extends JPanel implements UIObserver {
connectButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP"));
Component[][] comps = new Component[][]{
new Component[]{new UILabel("url"), wmsUrl, null, connectButton}
new Component[]{new UILabel("url"),
FineComponentsFactory.createFixHeightTextArea(wmsUrl, scale(36)),
null, connectButton}
};
JPanel northPane = FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 1.4, 0.2, 1.4});
JPanel northPane = FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 1.8, 0.2, 1.0});
wmsLayerPane = new JPanel(new BorderLayout());
resetWMSLayerPane(new ArrayList<>());

Loading…
Cancel
Save