diff --git a/designer_base/src/com/fr/design/dialog/BasicScrollPane.java b/designer_base/src/com/fr/design/dialog/BasicScrollPane.java index 9726fce27e..a59f1d2d40 100644 --- a/designer_base/src/com/fr/design/dialog/BasicScrollPane.java +++ b/designer_base/src/com/fr/design/dialog/BasicScrollPane.java @@ -104,7 +104,7 @@ public abstract class BasicScrollPane extends BasicBeanPane{ protected void layoutContentPane() { leftcontentPane = createContentPane(); - leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, original)); + leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 5, original)); this.add(leftcontentPane); } @@ -155,26 +155,30 @@ public abstract class BasicScrollPane extends BasicBeanPane{ } else { int preferheight = leftcontentPane.getPreferredSize().height; int value = scrollBar.getValue(); - + int baseValue = MAXVALUE - scrollBar.getVisibleAmount(); beginY = baseValue == 0 ? 0 : value * (preferheight - maxheight) / baseValue; if(MAXVALUE - scrollBar.getVisibleAmount() != 0) { beginY = value * (preferheight - maxheight) / (MAXVALUE - scrollBar.getVisibleAmount()); } } - int width = parent.getWidth(); - int height = parent.getHeight(); - if (leftcontentPane.getPreferredSize().height > maxheight) { - leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth(), height + beginY); - scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); - } else { - leftcontentPane.setBounds(0, 0, width, height); - } + setLeftContentPaneBouns(parent, scrollBar, beginY, maxheight); leftcontentPane.validate(); } } + protected void setLeftContentPaneBouns (Container parent, UIScrollBar scrollBar, int beginY, int maxheight) { + int width = parent.getWidth(); + int height = parent.getHeight(); + if (leftcontentPane.getPreferredSize().height > maxheight) { + leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - DET_WIDTH_OVER_HEIGHT, height + beginY); + scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); + } else { + leftcontentPane.setBounds(0, 0, width - DET_WIDTH, height); + } + } + protected boolean isShowScrollBar() { return true; } @@ -183,7 +187,7 @@ public abstract class BasicScrollPane extends BasicBeanPane{ public T updateBean() { return null; } - + /** * 用于在调用removeAll以后恢复原来pane的结构,放在这边是因为BarLayout是内部类 * @param pane diff --git a/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index 65f4e03f38..755d9cfaea 100644 --- a/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -45,7 +45,7 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { protected void initContentPane() { leftContentPane = createContentPane(); - leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 0, 0, 0, original)); + leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 10, 0, 0, original)); this.add(leftContentPane, BorderLayout.CENTER); } diff --git a/designer_base/src/com/fr/design/layout/TableLayoutHelper.java b/designer_base/src/com/fr/design/layout/TableLayoutHelper.java index ebf0c5e29f..5950a6d1dc 100644 --- a/designer_base/src/com/fr/design/layout/TableLayoutHelper.java +++ b/designer_base/src/com/fr/design/layout/TableLayoutHelper.java @@ -2,7 +2,6 @@ package com.fr.design.layout; import com.fr.design.constants.LayoutConstants; -import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.GUICoreUtils; @@ -19,8 +18,7 @@ public class TableLayoutHelper { public static final int FILL_LASTCOL_AND_ROW = 3; private static final int FIVE = 5; private static final int TEN = 10; - public static final int EXPANDABLE_PANE_WIDTH =290; - public static final int EXPANDABLE_PANE_HIGHT =24; + private TableLayoutHelper() { } @@ -276,15 +274,6 @@ public class TableLayoutHelper { return createTableLayoutPane(comp, row, column); } - public static JPanel createExpandablePaneWithTitle(String title, Component[][] components, double[] rowSize, double[] columnSize){ - JPanel jPanel = new JPanel(); - JPanel contentPane = createTableLayoutPane4ChartWithoutTitle(components, rowSize, columnSize); - contentPane.setBorder(BorderFactory.createEmptyBorder(10 ,0, 0, 0)); - jPanel.add(contentPane); - return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, jPanel); - } - - public static void main (String[] args) { JFrame jf = new JFrame("test"); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java index 8c4a21c814..183fb78417 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java @@ -4,6 +4,9 @@ package com.fr.design.mainframe.chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import javax.swing.*; +import java.awt.*; + public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { public abstract void populate(ChartCollection collection); @@ -25,6 +28,12 @@ public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { } + protected void initContentPane() { + leftContentPane = createContentPane(); + leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 0, 0, 0, original)); + this.add(leftContentPane, BorderLayout.CENTER); + } + /** * 刷新图表数据界面 * @param collection 图表收集器 diff --git a/designer_chart/src/com/fr/plugin/chart/designer/AbstractVanChartTabPane.java b/designer_chart/src/com/fr/plugin/chart/designer/AbstractVanChartTabPane.java new file mode 100644 index 0000000000..5fa51376ab --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/AbstractVanChartTabPane.java @@ -0,0 +1,30 @@ +package com.fr.plugin.chart.designer; + +import com.fr.design.gui.iscrollbar.UIScrollBar; +import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by mengao on 2017/8/11. + */ +public abstract class AbstractVanChartTabPane extends AbstractChartTabPane { + + protected void layoutContentPane() { + leftcontentPane = createContentPane(); + leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, original)); + this.add(leftcontentPane); + } + + protected void setLeftContentPaneBouns (Container parent, UIScrollBar scrollBar, int beginY, int maxheight) { + int width = parent.getWidth(); + int height = parent.getHeight(); + if (leftcontentPane.getPreferredSize().height > maxheight) { + leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth(), height + beginY); + scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); + } else { + leftcontentPane.setBounds(0, 0, width, height); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java index 7c763e3486..1b500ece87 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java @@ -15,27 +15,19 @@ import java.awt.*; */ public class TableLayout4VanChartHelper { - private static final int DEFAULT_GAP = 0; private static final int SMALL_GAP = 20; + public static final int EXPANDABLE_PANE_WIDTH =290; + public static final int EXPANDABLE_PANE_HIGHT =24; public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { - return new UIExpandablePane(title, TableLayoutHelper.EXPANDABLE_PANE_WIDTH, TableLayoutHelper.EXPANDABLE_PANE_HIGHT, panel); + return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel); } public static JPanel createExpandablePaneWithTitle(String title, Component component) { JPanel panel = (JPanel) component; - return new UIExpandablePane(title, TableLayoutHelper.EXPANDABLE_PANE_WIDTH, TableLayoutHelper.EXPANDABLE_PANE_HIGHT, panel); + return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel); } - public static JPanel createGapTableLayoutPane(Component[][] components) { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, SMALL_GAP, LayoutConstants.VGAP_LARGE); - } - - public static JPanel createGapTableLayoutPane(String title, Component component) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartLegendPane.java b/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartLegendPane.java index 25c26a95f5..2cbb947790 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartLegendPane.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartLegendPane.java @@ -3,8 +3,8 @@ package com.fr.plugin.chart.designer.style; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.mainframe.chart.PaneTitleConstants; -import com.fr.design.dialog.BasicScrollPane; import com.fr.plugin.chart.attr.VanChartLegend; +import com.fr.plugin.chart.designer.AbstractVanChartTabPane; import com.fr.plugin.chart.designer.PlotFactory; import com.fr.plugin.chart.vanchart.VanChart; @@ -14,7 +14,7 @@ import java.awt.*; /** * 属性表, 图表样式-图例 界面. */ -public class VanChartLegendPane extends BasicScrollPane { +public class VanChartLegendPane extends AbstractVanChartTabPane { private static final long serialVersionUID = 7553135492053931171L; private VanChartPlotLegendPane legendContent; diff --git a/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartTitlePane.java b/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartTitlePane.java index 492e11b761..b62fe4062b 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartTitlePane.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/style/VanChartTitlePane.java @@ -5,7 +5,6 @@ import com.fr.base.Formula; import com.fr.base.Style; import com.fr.base.Utils; import com.fr.chart.base.TextAttr; -import com.fr.design.dialog.BasicScrollPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -19,6 +18,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.general.Inter; import com.fr.plugin.chart.attr.VanChartTitle; +import com.fr.plugin.chart.designer.AbstractVanChartTabPane; import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; import com.fr.plugin.chart.designer.component.VanChartFloatPositionPane; import com.fr.plugin.chart.designer.component.background.VanChartBackgroundWithOutShadowWithRadiusPane; @@ -37,7 +37,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; // 属性表-样式 标题界面 -public class VanChartTitlePane extends BasicScrollPane { +public class VanChartTitlePane extends AbstractVanChartTabPane { private static final long serialVersionUID = -2438898431228882682L; private static final int WIDTH = 165;