diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java index e5e765510b..8da9536f69 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java @@ -1,11 +1,15 @@ package com.fr.design.gui.frpane; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.data.impl.TreeNodeAttr; import com.fr.data.impl.TreeNodeWrapper; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.ControlPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -26,7 +30,6 @@ import javax.swing.JPanel; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.JTree; -import javax.swing.BorderFactory; import javax.swing.JOptionPane; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; @@ -41,6 +44,8 @@ import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; +import static com.fine.theme.utils.FineUIScale.scale; + public class JTreeControlPane extends ControlPane { // 添加一个treeNode private AddTreeNodeAction addTreeNode; @@ -59,7 +64,7 @@ public class JTreeControlPane extends ControlPane { } private void initComponents(NameableCreator[] creators, BasicBeanPane updatePane) { - this.setLayout(new BorderLayout(2, 2)); + this.setLayout(new BorderLayout(FineUIScale.scale(10), 0)); this.updatePane = updatePane; // LeftPane JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -79,8 +84,10 @@ public class JTreeControlPane extends ControlPane { checkButtonEnabled(); } }); - tree.setPreferredSize(new Dimension(170, 350)); + tree.setPreferredSize(scale(new Dimension(170, 350))); tree.setCellRenderer(renderer); + leftPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); + FineUIStyle.setStyle(tree, FineUIStyle.PURE_TREE); // JTreeControlPane控制栏 ToolBarDef toolbarDef = new ToolBarDef(); @@ -256,7 +263,7 @@ public class JTreeControlPane extends ControlPane { this.setText(((NameObject) userObj).getName()); } } - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0)); + this.setBorder(new ScaledEmptyBorder(0, 0, 2, 0)); return this; } }; diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java index b24964f1cc..56976414f6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java @@ -1,8 +1,12 @@ package com.fr.design.gui.frpane.tree.layer.config; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.border.FineBorderFactory; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.ControlPane; import com.fr.design.gui.icontainer.UIScrollPane; @@ -15,14 +19,25 @@ import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; -import javax.swing.*; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.*; -import java.awt.*; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.util.ArrayList; +import static com.fine.theme.utils.FineUIScale.scale; + /** * Created by juhaoyu on 16/9/21. */ @@ -44,7 +59,7 @@ public class LayerDataControlPane extends ControlPane { public LayerDataControlPane() { - this.setLayout(new BorderLayout(2, 2)); + this.setLayout(new BorderLayout(FineUIScale.scale(10), 0)); //创建层编辑panel configPane = new LayerDataConfigPane(); //创建树结构及树控件 @@ -58,7 +73,7 @@ public class LayerDataControlPane extends ControlPane { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); leftPane.add(new UIScrollPane(tree), BorderLayout.CENTER); - tree.setPreferredSize(new Dimension(170, 350)); + tree.setPreferredSize(scale(new Dimension(170, 350))); tree.setCellRenderer(renderer); tree.addTreeSelectionListener(new TreeSelectionListener() { @@ -70,6 +85,7 @@ public class LayerDataControlPane extends ControlPane { checkButtonEnabled(); } }); + FineUIStyle.setStyle(tree, FineUIStyle.PURE_TREE); // JTreeControlPane控制栏 @@ -79,7 +95,7 @@ public class LayerDataControlPane extends ControlPane { UIToolbar toolBar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolBar); leftPane.add(toolBar, BorderLayout.NORTH); - + leftPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); this.add(leftPane, BorderLayout.WEST); this.add(this.configPane, BorderLayout.CENTER); @@ -122,7 +138,7 @@ public class LayerDataControlPane extends ControlPane { this.setText(((NameObject) userObj).getName()); } } - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0)); + this.setBorder(new ScaledEmptyBorder(0, 0, 2, 0)); return this; } }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java index e0c1622ac0..5ebfea2320 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java @@ -1,5 +1,6 @@ package com.fr.van.chart.drillmap.designer.data.comp; +import com.fine.theme.icon.LazyIcon; import com.fr.design.border.FineBorderFactory; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; @@ -7,6 +8,7 @@ import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.stable.StringUtils; +import javax.swing.Icon; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; @@ -117,8 +119,17 @@ public class MapDataTree extends JTree { DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; String name = getPresentName(treeNode); this.setText(name); + this.setIcon(getTreeIcon(expanded, treeNode)); return this; } + + private Icon getTreeIcon(boolean expanded, DefaultMutableTreeNode treeNode) { + boolean folderFile = treeNode.getChildCount() != 0; + if (folderFile) { + return expanded ? new LazyIcon("folder_open") : new LazyIcon("folder"); + } + return new LazyIcon("file"); + } }; protected String getPresentName(DefaultMutableTreeNode treeNode) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java index cc37b54440..1acdea5de8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java @@ -13,17 +13,18 @@ import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.AbstractVanChartScrollPane; import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Component; +import static com.fine.swing.ui.layout.Layouts.*; + /** * Created by hufan on 2017/1/12. */ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { private UIButtonGroup typeButton; private UISpinner horizontalProportion; + private JPanel horizontalProportionRow; private GanttAxisStylePane horizontalHeaderPane; private GanttAxisStylePaneWithPosition verticalHeaderPane; @@ -70,26 +71,25 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { proportionPane.add(horizontalProportion, BorderLayout.CENTER); proportionPane.add(new UILabel("%"), BorderLayout.EAST); - JPanel panel = new JPanel(new BorderLayout(0, 5)); - - panel.add(typeButton, BorderLayout.NORTH); - panel.add(horizontalProportion, BorderLayout.CENTER); + horizontalProportionRow = row( + flex(1.2), cell(proportionPane).weight(3) + ).getComponent(); - typeButton.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - checkoutPaneVisible(); - } - }); + typeButton.addChangeListener(e -> checkoutPaneVisible()); - JPanel jPanel = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, - new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Horizontal_Proportion")), panel); + JPanel jPanel = column(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Horizontal_Proportion"))).weight(1.2), + cell(typeButton).weight(3) + ), + cell(horizontalProportionRow) + ).getComponent(); return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Percent"), jPanel, true); } private void checkoutPaneVisible() { - horizontalProportion.setVisible(typeButton.getSelectedIndex() == 1); + horizontalProportionRow.setVisible(typeButton.getSelectedIndex() == 1); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java index f2da407285..8440628ea7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java @@ -1,14 +1,12 @@ package com.fr.van.chart.range.component; +import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.plugin.chart.range.SectionLegend; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; public class SectionLegendPane extends JPanel { private static final long serialVersionUID = 1614283200308877353L; @@ -24,18 +22,8 @@ public class SectionLegendPane extends JPanel { private void initComponents() { intervalConfigPane = createSectionIntervalConfigPane(this.parent); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] col = {f}; - double[] row = {p}; - Component[][] components = new Component[][]{ - new Component[]{intervalConfigPane}, - }; - - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); - this.setLayout(new BorderLayout()); - this.add(panel, BorderLayout.CENTER); + this.add(intervalConfigPane, BorderLayout.CENTER); } protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { @@ -54,7 +42,7 @@ public class SectionLegendPane extends JPanel { @Override protected int getBoundWidth() { - return WIDTH; + return FineUIScale.scale(WIDTH); } }; }