Browse Source

CHART-15033 linux设计器标题图例悬浮位置设置框的问题

feature/big-screen
白岳 4 years ago
parent
commit
66b344fba6
  1. 74
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  2. 73
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  3. 59
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

74
designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java

@ -9,14 +9,17 @@ import com.fr.stable.Constants;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -72,7 +75,7 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y , width, height); this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y, width, height);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height);
} }
@ -82,15 +85,17 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
/** /**
* show对话框 * show对话框
*
* @param fatherPane 上一层界面 parentPane * @param fatherPane 上一层界面 parentPane
* @param ob 传入的内容在show之前populate * @param ob 传入的内容在show之前populate
*/ */
public void show(JComponent fatherPane, T ob) { public void show(JComponent fatherPane, T ob) {
populateBean(ob); populateBean(ob);
UIDialog dialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); if (showDialog == null) {
showDialog = dialog; showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane));
}
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
dialog.setVisible(true); showDialog.setVisible(true);
} }
/** /**
@ -192,7 +197,7 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
} }
private boolean containsPoint(Point point) { private boolean containsPoint(Point point) {
if(arrowPosition == Constants.TOP){ if (arrowPosition == Constants.TOP) {
//箭头和按钮也算在pane内 //箭头和按钮也算在pane内
Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT); Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT);
return judgedBounds.contains(point); return judgedBounds.contains(point);
@ -201,7 +206,7 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
} }
private void initComponents() { private void initComponents() {
if(arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
this.setBounds(20, 10, bounds.width, bounds.height); this.setBounds(20, 10, bounds.width, bounds.height);
} else { } else {
this.setBounds(10, 10, bounds.width, bounds.height); this.setBounds(10, 10, bounds.width, bounds.height);
@ -240,14 +245,14 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL, 0); polygon.addPoint(GAP_SMALL, 0);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP), 0); polygon.addPoint((int) (bounds.width * time + GAP), 0);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, GAP_SMALL); polygon.addPoint(bounds.width + GAP, GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG); polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG);
polygon.addPoint(0, bounds.height + GAP_BIG); polygon.addPoint(0, bounds.height + GAP_BIG);
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(0, 0); polygon.addPoint(0, 0);
polygon.addPoint(bounds.width + GAP, 0); polygon.addPoint(bounds.width + GAP, 0);
@ -274,15 +279,15 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL + 1, 1); polygon.addPoint(GAP_SMALL + 1, 1);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL + 1); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP), 1); polygon.addPoint((int) (bounds.width * time + GAP), 1);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL + 1); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL + 1); polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1); polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, bounds.height + GAP_BIG - 1); polygon.addPoint(1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
} else if(arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(1, 1); polygon.addPoint(1, 1);
polygon.addPoint(bounds.width + GAP - 1, 1); polygon.addPoint(bounds.width + GAP - 1, 1);
polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG); polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG);
@ -295,19 +300,6 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
return polygon; return polygon;
} }
/**
* 画出界面的样式, 边框等.
*/
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
Stroke oldStroke = g2d.getStroke();
g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
g2d.setStroke(oldStroke);
}
protected void initComponents() { protected void initComponents() {
setUndecorated(true); setUndecorated(true);
try { try {
@ -318,7 +310,27 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
final JPanel contentPane = (JPanel) this.getContentPane(); final JPanel contentPane = (JPanel) this.getContentPane();
this.setLayout(null); this.setLayout(null);
contentPane.add(UIBubbleFloatPane.this); contentPane.add(UIBubbleFloatPane.this);
setVisible(true); contentPane.setBorder(new Border() {
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Stroke oldStroke = g2d.getStroke();
g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
g2d.setStroke(oldStroke);
}
@Override
public Insets getBorderInsets(Component c) {
return null;
}
@Override
public boolean isBorderOpaque() {
return false;
}
});
} }
/** /**

73
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -1,7 +1,6 @@
package com.fr.van.chart.designer.style; package com.fr.van.chart.designer.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.UIBubbleFloatPane;
@ -61,6 +60,7 @@ public class VanChartPlotLegendPane extends BasicPane {
private UIButtonGroup<LayoutType> layoutButton; private UIButtonGroup<LayoutType> layoutButton;
private JPanel layoutPane; private JPanel layoutPane;
private VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
private UIBubbleFloatPane uiBubbleFloatPane;
//区域显示策略 恢复用注释。下面4行删除。 //区域显示策略 恢复用注释。下面4行删除。
private UIButtonGroup<Integer> customSize; private UIButtonGroup<Integer> customSize;
@ -80,7 +80,7 @@ public class VanChartPlotLegendPane extends BasicPane {
initComponents(); initComponents();
} }
public VanChartPlotLegendPane(VanChartStylePane parent){ public VanChartPlotLegendPane(VanChartStylePane parent) {
this.parent = parent; this.parent = parent;
initComponents(); initComponents();
} }
@ -118,9 +118,9 @@ public class VanChartPlotLegendPane extends BasicPane {
new Component[]{legendPane}, new Component[]{legendPane},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,row,col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
addLegendListener(); addLegendListener();
} }
@ -133,7 +133,7 @@ public class VanChartPlotLegendPane extends BasicPane {
}); });
} }
protected JPanel createLegendPaneWithoutHighlight(){ protected JPanel createLegendPaneWithoutHighlight() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = new VanChartBackgroundWithOutImagePane();
@ -141,19 +141,19 @@ public class VanChartPlotLegendPane extends BasicPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = { p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()), null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createLegendPane(){ protected JPanel createLegendPane() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = new VanChartBackgroundWithOutImagePane();
highlightPane = createHighlightPane(); highlightPane = createHighlightPane();
@ -166,14 +166,14 @@ public class VanChartPlotLegendPane extends BasicPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = { p,p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel), null},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
@ -205,9 +205,9 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), location},
new Component[]{null,customFloatPositionButton} new Component[]{null, customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
@ -241,7 +241,7 @@ public class VanChartPlotLegendPane extends BasicPane {
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private void initPositionListener(){ private void initPositionListener() {
location.addChangeListener(new ChangeListener() { location.addChangeListener(new ChangeListener() {
@Override @Override
@ -262,18 +262,20 @@ public class VanChartPlotLegendPane extends BasicPane {
checkLayoutPaneVisible(); checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
if(customFloatPositionPane == null) { if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
} }
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen(); Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth()/2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
UIBubbleFloatPane<Style> pane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override @Override
public void updateContentPane() { public void updateContentPane() {
parent.attributeChanged(); parent.attributeChanged();
} }
}; };
pane.show(VanChartPlotLegendPane.this, null); }
uiBubbleFloatPane.show(VanChartPlotLegendPane.this, null);
} }
}); });
} }
@ -309,19 +311,19 @@ public class VanChartPlotLegendPane extends BasicPane {
// return limitPane; // return limitPane;
} }
private JPanel createHighlightPane(){ private JPanel createHighlightPane() {
highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")); highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight"));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p,p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{highlightLabel, highlightButton} new Component[]{highlightLabel, highlightButton}
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
} }
protected void checkAllUse() { protected void checkAllUse() {
@ -368,6 +370,7 @@ public class VanChartPlotLegendPane extends BasicPane {
/** /**
* 标题 * 标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -375,7 +378,7 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
public void updateBean(VanChartLegend legend) { public void updateBean(VanChartLegend legend) {
if(legend == null) { if (legend == null) {
legend = new VanChartLegend(); legend = new VanChartLegend();
} }
legend.setLegendVisible(isLegendVisible.isSelected()); legend.setLegendVisible(isLegendVisible.isSelected());
@ -383,7 +386,7 @@ public class VanChartPlotLegendPane extends BasicPane {
borderPane.update(legend); borderPane.update(legend);
backgroundPane.update(legend); backgroundPane.update(legend);
if(!customFloatPositionButton.isSelected()){ if (!customFloatPositionButton.isSelected()) {
legend.setPosition(location.getSelectedItem()); legend.setPosition(location.getSelectedItem());
} else { } else {
legend.setPosition(-1); legend.setPosition(-1);
@ -397,7 +400,7 @@ public class VanChartPlotLegendPane extends BasicPane {
//legend.setLimitAttribute(limitPane.updateBean()); //legend.setLimitAttribute(limitPane.updateBean());
legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
if(highlightButton != null && highlightButton.getSelectedItem() != null){ if (highlightButton != null && highlightButton.getSelectedItem() != null) {
legend.setHighlight(highlightButton.getSelectedItem()); legend.setHighlight(highlightButton.getSelectedItem());
} }
} }
@ -408,7 +411,7 @@ public class VanChartPlotLegendPane extends BasicPane {
textAttrPane.populate(legend.getFRFont()); textAttrPane.populate(legend.getFRFont());
borderPane.populate(legend); borderPane.populate(legend);
backgroundPane.populate(legend); backgroundPane.populate(legend);
if(!legend.isFloating()){ if (!legend.isFloating()) {
location.setSelectedItem(legend.getPosition()); location.setSelectedItem(legend.getPosition());
} }
customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionButton.setSelected(legend.isFloating());
@ -420,7 +423,7 @@ public class VanChartPlotLegendPane extends BasicPane {
maxProportion.setValue(legend.getMaxHeight()); maxProportion.setValue(legend.getMaxHeight());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//limitPane.populateBean(legend.getLimitAttribute()); //limitPane.populateBean(legend.getLimitAttribute());
if(highlightButton != null){ if (highlightButton != null) {
highlightButton.setSelectedItem(legend.isHighlight()); highlightButton.setSelectedItem(legend.isHighlight());
boolean largeDataModel = PlotFactory.largeDataModel(plot); boolean largeDataModel = PlotFactory.largeDataModel(plot);
highlightButton.setEnabled(!largeDataModel); highlightButton.setEnabled(!largeDataModel);

59
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -2,7 +2,6 @@ package com.fr.van.chart.designer.style;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chartx.config.info.constant.ConfigType; import com.fr.chartx.config.info.constant.ConfigType;
@ -61,6 +60,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private UIToggleButton useHtml; private UIToggleButton useHtml;
private UIToggleButton customFloatPositionButton; private UIToggleButton customFloatPositionButton;
private VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
private UIBubbleFloatPane uiBubbleFloatPane;
//区域显示策略 恢复用注释。下面3行删除。 //区域显示策略 恢复用注释。下面3行删除。
private UIButtonGroup<Integer> limitSize; private UIButtonGroup<Integer> limitSize;
@ -101,7 +101,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
isTitleVisible.addActionListener(new ActionListener() { isTitleVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -111,7 +111,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
} }
private JPanel createTitlePane(){ private JPanel createTitlePane() {
backgroundPane = new VanChartBackgroundWithOutShadowWithRadiusPane(); backgroundPane = new VanChartBackgroundWithOutShadowWithRadiusPane();
@ -120,32 +120,32 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] column = {f, e}; double[] column = {f, e};
double[] rowSize = {p,p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitleContentPane(new double[]{p,p,p},column),null}, new Component[]{createTitleContentPane(new double[]{p, p, p}, column), null},
new Component[]{createTitlePositionPane(new double[]{p,p,p},column),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, column), null},
new Component[]{createTitleStylePane(),null}, new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{createDisplayStrategy(),null} new Component[]{createDisplayStrategy(), null}
}; };
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private JPanel createTitleContentPane(double[] row, double[] col){ private JPanel createTitleContentPane(double[] row, double[] col) {
titleContent = new TinyFormulaPane(); titleContent = new TinyFormulaPane();
useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html"));
UIComponentUtils.setLineWrap(useHtml); UIComponentUtils.setLineWrap(useHtml);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null ,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent},
new Component[]{null ,useHtml}, new Component[]{null, useHtml},
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), panel);
} }
private JPanel createTitlePositionPane(double[] row, double[] col){ private JPanel createTitlePositionPane(double[] row, double[] col) {
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
@ -157,25 +157,25 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT),alignmentPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT), alignmentPane},
new Component[]{null,customFloatPositionButton} new Component[]{null, customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
initPositionListener(); initPositionListener();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel);
} }
private JPanel createTitleStylePane(){ private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }
private JPanel createDisplayStrategy(){ private JPanel createDisplayStrategy() {
//区域显示策略 恢复用注释。开始删除。 //区域显示策略 恢复用注释。开始删除。
maxProportion = new UISpinner(0, 100, 1, 30); maxProportion = new UISpinner(0, 100, 1, 30);
limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")});
@ -203,7 +203,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
// return limitPane; // return limitPane;
} }
private void initPositionListener(){ private void initPositionListener() {
alignmentPane.addChangeListener(new ChangeListener() { alignmentPane.addChangeListener(new ChangeListener() {
@Override @Override
@ -225,15 +225,17 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (customFloatPositionPane == null) { if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
} }
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen(); Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
UIBubbleFloatPane<Style> pane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override @Override
public void updateContentPane() { public void updateContentPane() {
parent.attributeChanged(); parent.attributeChanged();
} }
}; };
pane.show(VanChartTitlePane.this, null); }
uiBubbleFloatPane.show(VanChartTitlePane.this, null);
} }
}); });
} }
@ -270,6 +272,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
/** /**
* 弹出框的界面标题 * 弹出框的界面标题
*
* @return 界面标题 * @return 界面标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -283,7 +286,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
@Override @Override
public void populateBean(VanChart chart) { public void populateBean(VanChart chart) {
VanChartTitle title = (VanChartTitle)chart.getTitle(); VanChartTitle title = (VanChartTitle) chart.getTitle();
if (title == null) { if (title == null) {
return; return;
} }
@ -293,7 +296,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} else { } else {
titleContent.populateBean(Utils.objectToString(title.getTextObject())); titleContent.populateBean(Utils.objectToString(title.getTextObject()));
} }
if(!title.isFloating()){ if (!title.isFloating()) {
alignmentPane.setSelectedItem(title.getPosition()); alignmentPane.setSelectedItem(title.getPosition());
} else { } else {
alignmentPane.setSelectedIndex(-1); alignmentPane.setSelectedIndex(-1);
@ -323,7 +326,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (chart == null) { if (chart == null) {
chart = new VanChart(); chart = new VanChart();
} }
VanChartTitle title = (VanChartTitle)chart.getTitle(); VanChartTitle title = (VanChartTitle) chart.getTitle();
if (title == null) { if (title == null) {
title = new VanChartTitle(StringUtils.EMPTY); title = new VanChartTitle(StringUtils.EMPTY);
} }
@ -341,7 +344,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (textAttr == null) { if (textAttr == null) {
textAttr = new TextAttr(); textAttr = new TextAttr();
} }
if(!customFloatPositionButton.isSelected()){ if (!customFloatPositionButton.isSelected()) {
title.setPosition(alignmentPane.getSelectedItem()); title.setPosition(alignmentPane.getSelectedItem());
} }
title.setUseHtml(useHtml.isSelected()); title.setUseHtml(useHtml.isSelected());

Loading…
Cancel
Save