Browse Source

Merge pull request #1546 in DESIGN/design from ~BJORN/design:release/10.0 to release/10.0

* commit '3f3c67455862e0aa4dfc1a8dfd997a45edcb0903':
  CHART-11709 代码质量
  CHART-11709
  CHART-11709	 自定义配色设置优化
feature/big-screen
Bjorn 5 years ago
parent
commit
a79effce52
  1. 33
      designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java
  2. 4
      designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java
  3. 111
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  4. 7
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java
  5. 15
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  6. 174
      designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java
  7. 245
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  8. 238
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java
  9. 19
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  10. 7
      designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java
  11. 3
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java
  12. 1
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java
  13. 5
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java
  14. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java
  15. 218
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  16. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  17. 1
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java
  18. 6
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java
  19. 9
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  20. 5
      designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java
  21. 6
      designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java
  22. 51
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  23. 7
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java
  24. 1
      designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java
  25. 5
      designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java
  26. 1
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java
  27. 7
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java
  28. 7
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java

33
designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java

@ -5,15 +5,22 @@ import com.fr.design.style.background.BackgroundJComponent;
import com.fr.design.style.background.gradient.GradientBackgroundPane; import com.fr.design.style.background.gradient.GradientBackgroundPane;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.*; import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.util.ArrayList;
import java.util.List;
import java.awt.AWTEvent;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener; import java.awt.event.AWTEventListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
@ -50,7 +57,7 @@ public abstract class AbstractPopBox extends JPanel {
} }
}; };
private void showPopupMenu() { protected void showPopupMenu() {
if (selectPopupWindow != null && selectPopupWindow.isVisible()) { if (selectPopupWindow != null && selectPopupWindow.isVisible()) {
hidePopupMenu(); hidePopupMenu();
return; return;
@ -98,12 +105,16 @@ public abstract class AbstractPopBox extends JPanel {
private void mouseClick(MouseEvent evt) { private void mouseClick(MouseEvent evt) {
Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY()); Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY());
Dimension popBoxD = AbstractPopBox.this.getSize(); Dimension popBoxD = AbstractPopBox.this.getSize();
Point popBoxP = AbstractPopBox.this.getLocationOnScreen(); try {
Dimension popMenuD = this.getControlWindow().getSize(); Point popBoxP = AbstractPopBox.this.getLocationOnScreen();
Point popMenuP = this.getControlWindow().getLocation(); Dimension popMenuD = this.getControlWindow().getSize();
Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD); Point popMenuP = this.getControlWindow().getLocation();
Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD); Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD);
if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) { Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD);
if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) {
this.hidePopupMenu();
}
} catch (Exception ignore){
this.hidePopupMenu(); this.hidePopupMenu();
} }
} }

4
designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java

@ -1,6 +1,6 @@
package com.fr.design.style.background.gradient; package com.fr.design.style.background.gradient;
import com.fr.design.style.background.gradient.GradientBar; import java.awt.Color;
/** /**
* 这个bar不能拖拽滑动 * 这个bar不能拖拽滑动
@ -8,6 +8,8 @@ import com.fr.design.style.background.gradient.GradientBar;
public class FixedGradientBar extends GradientBar { public class FixedGradientBar extends GradientBar {
private static final long serialVersionUID = 2787525421995954889L; private static final long serialVersionUID = 2787525421995954889L;
public static final Color NEW_CHARACTER = new Color(99, 178, 238);
public FixedGradientBar(int minvalue, int maxvalue) { public FixedGradientBar(int minvalue, int maxvalue) {
super(minvalue, maxvalue); super(minvalue, maxvalue);
} }

111
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -1,40 +1,38 @@
package com.fr.design.style.background.gradient; package com.fr.design.style.background.gradient;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.style.color.ColorSelectDetailPane; import com.fr.design.style.color.ColorSelectDetailPane;
import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
/** /**
* TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧 * TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧
*/ */
public class GradientBar extends JComponent implements UIObserver,ColorSelectable{ public class GradientBar extends JComponent implements UIObserver, ColorSelectable {
/** /**
* *
@ -54,12 +52,12 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
private UINumberField endLabel; private UINumberField endLabel;
private ChangeListener changeListener = null; private ChangeListener changeListener = null;
private UIObserverListener uiObserverListener; private List<UIObserverListener> uiObserverListener;
private static final int MOUSE_OFFSET = 4; private static final int MOUSE_OFFSET = 4;
private static final int MAX_VERTICAL = 45; private static final int MAX_VERTICAL = 45;
// 选中的颜色 // 选中的颜色
private Color color; private Color color;
@ -89,6 +87,11 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
iniListener(); iniListener();
} }
public void updateColor(Color begin, Color end) {
p1.setColorInner(begin);
p2.setColorInner(end);
}
protected void addMouseClickListener() { protected void addMouseClickListener() {
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -142,14 +145,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
private void iniListener() { private void iniListener() {
uiObserverListener = new ArrayList<>();
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() { this.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) { for (UIObserverListener observerListener : uiObserverListener) {
return; observerListener.doChange();
} }
uiObserverListener.doChange();
} }
}); });
} }
@ -199,14 +202,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
* 状态改变 * 状态改变
*/ */
public void stateChanged() { public void stateChanged() {
if (changeListener != null) { if (changeListener != null) {
changeListener.stateChanged(null); changeListener.stateChanged(null);
} }
} }
/** /**
* 增加监听 * 增加监听
* *
* @param changeListener 监听 * @param changeListener 监听
*/ */
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
@ -215,14 +218,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
/** /**
* 如果左右两个按钮还在初始位置就为true * 如果左右两个按钮还在初始位置就为true
* @return 同上 *
* @return 同上
*/ */
public boolean isOriginalPlace() { public boolean isOriginalPlace() {
return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max); return AssistUtils.equals(startLabel.getValue(), min) && AssistUtils.equals(endLabel.getValue(), max);
} }
/** /**
*
* @return * @return
*/ */
public double getStartValue() { public double getStartValue() {
@ -230,7 +233,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @return * @return
*/ */
public double getEndValue() { public double getEndValue() {
@ -238,7 +240,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @param startValue * @param startValue
*/ */
public void setStartValue(double startValue) { public void setStartValue(double startValue) {
@ -246,7 +247,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @param endValue * @param endValue
*/ */
public void setEndValue(double endValue) { public void setEndValue(double endValue) {
@ -254,7 +254,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @return * @return
*/ */
public SelectColorPointBtn getSelectColorPointBtnP1() { public SelectColorPointBtn getSelectColorPointBtnP1() {
@ -262,7 +261,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
} }
/** /**
*
* @return * @return
*/ */
public SelectColorPointBtn getSelectColorPointBtnP2() { public SelectColorPointBtn getSelectColorPointBtnP2() {
@ -276,7 +274,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
* *
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener; uiObserverListener.add(listener);
} }
@Override @Override
@ -288,22 +286,23 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
return true; return true;
} }
@Override @Override
public void setColor(Color color) { public void setColor(Color color) {
this.color = color; this.color = color;
} }
@Override @Override
public Color getColor() { public Color getColor() {
return this.color; return this.color;
} }
/** /**
* 选中颜色 * 选中颜色
* @param ColorCell 颜色单元格 *
*/ * @param ColorCell 颜色单元格
@Override */
public void colorSetted(ColorCell colorCell) { @Override
public void colorSetted(ColorCell colorCell) {
}
}
} }

7
designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.io.Serializable;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dialog; import java.awt.Dialog;
@ -13,7 +14,6 @@ import java.awt.FlowLayout;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.Serializable;
/** /**
@ -136,8 +136,13 @@ public class ColorSelectDialog extends MiddleChartDialog{
* void * void
*/ */
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){ public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){
showDialog(owner,pane,initialColor,selectePane,false);
}
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane, boolean alwaysOnTop){
ColorTracker okListener = new ColorTracker(pane); ColorTracker okListener = new ColorTracker(pane);
ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane); ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane);
dialog.setAlwaysOnTop(alwaysOnTop);
dialog.setModal(true); dialog.setModal(true);
dialog.show(); dialog.show();
} }

15
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -11,16 +11,21 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.*; import javax.swing.Box;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.util.ArrayList;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
/** /**
* The pane used to select color * The pane used to select color
@ -196,6 +201,6 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
@Override @Override
public void customButtonPressed() { public void customButtonPressed() {
pane = new ColorSelectDetailPane(Color.WHITE); pane = new ColorSelectDetailPane(Color.WHITE);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this); ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this, true);
} }
} }

174
designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java

@ -0,0 +1,174 @@
package com.fr.design.chartx.component.button;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-06
*/
public class ColorButton extends AbstractSelectBox<Color> {
private static final double DEL_WIDTH = 7;
public static final int WIDTH = 18;
private BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/chartChangeClose.png");
private Color color;
private boolean isMoveOn = false;
private ColorSelectPane colorPane;
private boolean lastButton;
private ChangeListener changeListener;
public ColorButton(Color color) {
this.color = color;
addMouseListener(getMouseListener());
}
public Dimension getPreferredSize() {
return new Dimension(WIDTH, WIDTH);
}
private void paintDeleteButton(Graphics g2d) {
Rectangle2D bounds = this.getBounds();
int x = (int) (bounds.getWidth() - DEL_WIDTH);
int y = 1;
g2d.drawImage(closeIcon, x, y, closeIcon.getWidth(), closeIcon.getHeight(), null);
}
public void setLastButton(boolean lastButton) {
this.lastButton = lastButton;
}
@Override
public void paint(Graphics g) {
this.setSize(WIDTH, WIDTH);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(color);
Rectangle2D rec = new Rectangle2D.Double(0, 0, WIDTH + 1, WIDTH + 1);
g2d.fill(rec);
if (isMoveOn && !lastButton) {
paintDeleteButton(g);
}
}
protected void deleteButton() {
}
private void checkMoveOn(boolean moveOn) {
this.isMoveOn = moveOn;
repaint();
}
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
mouseClick(e);
}
public void mouseEntered(MouseEvent e) {
checkMoveOn(true);
}
public void mouseExited(MouseEvent e) {
checkMoveOn(false);
}
};
}
public void mouseClick(MouseEvent e) {
if (!lastButton) {
Rectangle2D bounds = this.getBounds();
if (bounds == null) {
return;
}
if (e.getX() >= bounds.getWidth() - DEL_WIDTH && e.getY() <= DEL_WIDTH) {
deleteButton();
hidePopupMenu();
return;
}
}
//打开颜色选择面板
showPopupMenu();
}
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
colorPane = new ColorSelectPane(false) {
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
};
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
ColorButton.this.stateChanged();
}
});
return colorPane;
}
public void stateChanged() {
if (changeListener != null) {
changeListener.stateChanged(null);
}
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
/**
* 获取当前选中的颜色
*
* @return 当前选中的颜色
*/
public Color getSelectObject() {
return this.color;
}
/**
* 设置选中的颜色
*
* @param color 颜色
*/
public void setSelectObject(Color color) {
this.color = color;
colorPane.setColor(color);
fireDisplayComponent(ColorBackground.getInstance(color));
}
}

245
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java

@ -0,0 +1,245 @@
package com.fr.design.chartx.component.combobox;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.geom.Rectangle2D;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-05
* 一个带颜色展示的配色选择下拉框
*/
public class ColorSchemeComboBox extends UIComboBox {
private Map<String, ColorInfo> colorSchemes;
public ColorSchemeComboBox() {
this(null);
}
public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes) {
//通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。
if (colorSchemes == null) {
colorSchemes = getColorSchemesFromConfig();
}
this.colorSchemes = colorSchemes;
this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray()));
this.setRenderer(new ColorSchemeCellRenderer());
}
private Map<String, ColorInfo> getColorSchemesFromConfig() {
Map<String, ColorInfo> colorSchemes = new LinkedHashMap<>();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
//所有的样式名称
Iterator names = config.names();
//添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle();
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
Object firstName = names.next();
ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName);
if (defaultStyle == null) {
defaultStyle = firstStyle;
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
//添加其他的配色方案
while (names.hasNext()) {
Object key = names.next();
ChartColorMatching colorMatching = (ChartColorMatching) config.getPreStyle(key);
colorSchemes.put(colorMatching.getId(), colorMatchingToColorInfo(colorMatching));
}
//添加自定义组合色和自定义渐变色
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Combination_Color"), null);
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Gradient"), null);
return colorSchemes;
}
public ColorInfo getSelectColorInfo() {
String selectedItem = (String) getSelectedItem();
return colorSchemes.get(selectedItem);
}
private ColorInfo colorMatchingToColorInfo(ChartColorMatching colorMatching) {
ColorInfo colorInfo = new ColorInfo();
colorInfo.setGradient(colorMatching.getGradient());
colorInfo.setColors(colorMatching.getColorList());
return colorInfo;
}
public SelectType getSelectType() {
int selectedIndex = this.getSelectedIndex();
int itemCount = this.getItemCount();
if (selectedIndex == itemCount - 1) {
return SelectType.GRADATION_COLOR;
}
if (selectedIndex == itemCount - 2) {
return SelectType.COMBINATION_COLOR;
}
if (selectedIndex == 0) {
return SelectType.DEFAULT;
}
return SelectType.NORMAL;
}
public void setSelectType(SelectType selectType) {
int itemCount = this.getItemCount();
switch (selectType) {
case DEFAULT:
setSelectedIndex(0);
break;
case GRADATION_COLOR:
setSelectedIndex(itemCount - 1);
break;
case COMBINATION_COLOR:
setSelectedIndex(itemCount - 2);
break;
}
}
public enum SelectType {
DEFAULT,
COMBINATION_COLOR,
GRADATION_COLOR,
NORMAL
}
public class ColorInfo {
private List<Color> colors;
private boolean gradient;
public List<Color> getColors() {
return colors;
}
public void setColors(List<Color> colors) {
this.colors = colors;
}
public boolean isGradient() {
return gradient;
}
public void setGradient(boolean gradient) {
this.gradient = gradient;
}
}
/**
* CellRenderer.
*/
class ColorSchemeCellRenderer extends UIComboBoxRenderer {
private String schemeName = Toolkit.i18nText("Fine-Design_Report_Default");
//左边距
private static final double X = 4d;
//上边距
private static final double Y = 4d;
private static final String BLANK_SPACE = " ";
private static final int HEIGHT = 20;
private static final int MAX_COUNT = 5;
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
preferredSize.setSize(super.getPreferredSize().getWidth(), HEIGHT);
return preferredSize;
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.schemeName = GeneralUtils.objectToString(value);
ColorInfo colorInfo = colorSchemes.get(schemeName);
if (colorInfo == null) {
comp.setText(BLANK_SPACE + schemeName);
} else {
FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont());
double width = (HEIGHT - 2 * Y) * MAX_COUNT;
String fill = BLANK_SPACE;
//图形和文字之间留的宽度大于3倍的X
while (fontMetrics.stringWidth(fill) < width + 3 * X) {
fill += BLANK_SPACE;
}
comp.setText(fill + schemeName);
}
comp.setToolTipText(schemeName);
return comp;
}
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
ColorInfo colorInfo = colorSchemes.get(schemeName);
if (colorInfo != null) {
if (colorInfo.isGradient()) {
drawGradient(g2d, colorInfo.getColors());
} else {
drawCombineColor(g2d, colorInfo.getColors());
}
}
}
private void drawGradient(Graphics2D g2d, List<Color> colors) {
//上下留4px,宽度等于5倍高
double height = HEIGHT - 2 * Y;
double width = height * MAX_COUNT;
LinearGradientPaint linearGradientPaint = new LinearGradientPaint((float) X, (float) Y, (float) (X + width), (float) Y, new float[]{0f, 1f}, colors.toArray(new Color[colors.size()]));
g2d.setPaint(linearGradientPaint);
Rectangle2D rec = new Rectangle2D.Double(X, Y, width, height);
g2d.fill(rec);
}
private void drawCombineColor(Graphics2D g2d, List<Color> colors) {
int size = Math.min(colors.size(), MAX_COUNT);
double height = HEIGHT - 2 * Y;
double width = height * MAX_COUNT / size;
for (int i = 0; i < size; i++) {
g2d.setPaint(colors.get(i));
Rectangle2D rec = new Rectangle2D.Double(X + width * i, Y, width, height);
g2d.fill(rec);
}
}
}
}

238
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java

@ -0,0 +1,238 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.chartx.component.button.ColorButton;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* 配色方案选择组合色之后可以调整颜色的组件
*
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-25
*/
public class ChartColorAdjustPane extends JPanel implements UIObserver {
public static final Color[] DEFAULT_COLORS = {
new Color(99, 178, 238),
new Color(118, 218, 145),
new Color(248, 203, 127),
new Color(248, 149, 136),
new Color(124, 214, 207),
new Color(145, 146, 171),
new Color(120, 152, 225),
new Color(239, 166, 102),
new Color(237, 221, 134),
new Color(153, 135, 206),
};
private static final int COUNT_OF_ROW = 8;
private static final int MAX_BUTTON = 40;
private List<ColorButton> colorButtons = new ArrayList<>();
private List<UIObserverListener> uiObserverListener;
private ChangeListener changeListener;
public ChartColorAdjustPane() {
this(DEFAULT_COLORS);
}
public ChartColorAdjustPane(Color[] colors) {
iniListener();
createColorButton(colors);
createContentPane();
}
public void updateColor() {
updateColor(DEFAULT_COLORS);
}
public void updateColor(Color[] colors) {
createColorButton(colors);
relayout();
}
public Color[] getColors() {
int size = colorButtons.size();
Color[] colors = new Color[size];
for (int i = 0; i < size; i++) {
colors[i] = colorButtons.get(i).getSelectObject();
}
return colors;
}
private void relayout() {
this.removeAll();
createContentPane();
this.validate();
this.repaint();
}
private void createContentPane() {
VerticalFlowLayout layout = new VerticalFlowLayout(0, 0, 0);
layout.setAlignLeft(true);
this.setLayout(layout);
for (int i = 0, size = colorButtons.size(); i < size; i += COUNT_OF_ROW) {
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
int count = i + COUNT_OF_ROW > colorButtons.size() ? colorButtons.size() : i + COUNT_OF_ROW;
for (int j = i; j < count; j++) {
colorButtons.get(j).setLastButton(false);
panel.add(colorButtons.get(j));
}
if (i + COUNT_OF_ROW > colorButtons.size()) {
panel.add(new AddColorButton());
this.add(panel);
} else if (i + COUNT_OF_ROW == colorButtons.size() && colorButtons.size() != MAX_BUTTON) {
this.add(panel);
this.add(new AddColorButton());
} else {
this.add(panel);
}
}
if (colorButtons.size() == 1) {
colorButtons.get(0).setLastButton(true);
}
}
private void createColorButton(Color[] colors) {
colorButtons.clear();
for (Color color : colors) {
colorButtons.add(createColorButton(color));
}
}
private ColorButton createColorButton(Color color) {
ColorButton colorButton = new ColorButton(color) {
@Override
protected void deleteButton() {
colorButtons.remove(this);
stateChanged();
relayout();
}
};
colorButton.addChangeListener(changeListener);
return colorButton;
}
private void iniListener() {
uiObserverListener = new ArrayList<>();
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
for (UIObserverListener observerListener : uiObserverListener) {
observerListener.doChange();
}
}
});
}
}
public void stateChanged() {
if (changeListener != null) {
changeListener.stateChanged(null);
}
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener.add(listener);
}
public boolean shouldResponseChangeListener() {
return true;
}
private class AddColorButton extends AbstractSelectBox<Color> {
BufferedImage image = BaseUtils.readImageWithCache("/com/fr/design/images/buttonicon/add.png");
public AddColorButton() {
addMouseListener(getMouseListener());
}
@Override
public void paint(Graphics g) {
this.setSize(ColorButton.WIDTH, ColorButton.WIDTH);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(Color.WHITE);
Rectangle2D rec = new Rectangle2D.Double(0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1);
g2d.fill(rec);
g2d.drawImage(image, 0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1, null);
}
public Dimension getPreferredSize() {
return new Dimension(ColorButton.WIDTH, ColorButton.WIDTH);
}
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
showPopupMenu();
}
};
}
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
ColorSelectPane colorPane = new ColorSelectPane(false) {
public void setVisible(boolean b) {
super.setVisible(b);
}
};
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
Color color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
colorButtons.add(createColorButton(color));
ChartColorAdjustPane.this.stateChanged();
relayout();
}
});
return colorPane;
}
public Color getSelectObject() {
return null;
}
public void setSelectObject(Color color) {
}
}
}

19
designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java

@ -7,11 +7,12 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartAccColorPane; import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.design.style.background.gradient.FixedGradientBar;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
@ -20,8 +21,6 @@ import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/** /**
@ -37,7 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private UIButton accButton; private UIButton accButton;
private UIButton gradientButton; private UIButton gradientButton;
private ChartAccColorPane colorAcc; private ChartColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient; private FixedGradientBar colorGradient;
public ChartPreFillStylePane() { public ChartPreFillStylePane() {
@ -53,13 +52,13 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
JPanel buttonPane = new JPanel(); JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT));
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Acc_Set"))); buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color")));
buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color"))); buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")));
customPane.add(buttonPane, BorderLayout.NORTH); customPane.add(buttonPane, BorderLayout.NORTH);
changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
changeColorSetPane.add(colorAcc = new ChartAccColorPane(), "acc"); changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER); customPane.add(changeColorSetPane, BorderLayout.CENTER);
@ -68,7 +67,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
customPane.setPreferredSize(new Dimension(200, 200)); customPane.setPreferredSize(new Dimension(200, 200));
colorGradient.setPreferredSize(new Dimension(120, 30)); colorGradient.setPreferredSize(new Dimension(120, 30));
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black); colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {p, p}; double[] columnSize = {p, p};
@ -131,7 +130,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
if (colorList.size() > 0) { if (colorList.size() > 0) {
colorAcc.populateBean(colorList.toArray(new Color[colorList.size()])); colorAdjustPane.updateColor(colorList.toArray(new Color[colorList.size()]));
} }
} }
} }
@ -152,7 +151,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
} else { } else {
chartColorMatching.setGradient(false); chartColorMatching.setGradient(false);
Color[] colors = colorAcc.updateBean(); Color[] colors = colorAdjustPane.getColors();
for(Color color : colors) { for(Color color : colors) {
colorList.add(color); colorList.add(color);
} }

7
designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java

@ -6,6 +6,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.van.chart.column.VanChartCustomStackAndAxisConditionPane; import com.fr.van.chart.column.VanChartCustomStackAndAxisConditionPane;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.line.VanChartLineSeriesPane; import com.fr.van.chart.line.VanChartLineSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -27,7 +28,6 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createLineTypePane()}, new Component[]{createLineTypePane()},
new Component[]{createMarkerPane()}, new Component[]{createMarkerPane()},
new Component[]{createAreaFillColorPane()}, new Component[]{createAreaFillColorPane()},
@ -44,4 +44,9 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane {
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() { protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() {
return VanChartCustomStackAndAxisConditionPane.class; return VanChartCustomStackAndAxisConditionPane.class;
} }
//风格
protected VanChartBeautyPane createStylePane() {
return new VanChartBeautyPane();
}
} }

3
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java

@ -37,14 +37,13 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createBubblePane()}, new Component[]{createBubblePane()},
new Component[]{createStackedAndAxisPane()}, new Component[]{createStackedAndAxisPane()},
new Component[]{null} new Component[]{null}
}; };
if (!((VanChartBubblePlot) plot).isForceBubble()) { if (!((VanChartBubblePlot) plot).isForceBubble()) {
components[3] = new Component[]{createLargeDataModelPane()}; components[2] = new Component[]{createLargeDataModelPane()};
} }
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col);

1
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java

@ -53,7 +53,6 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; double[] rowSize = {p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})}, new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})},
new Component[]{createBorderPane()}, new Component[]{createBorderPane()},
new Component[]{createStackedAndAxisPane()}, new Component[]{createStackedAndAxisPane()},

5
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java

@ -4,7 +4,6 @@ import com.fr.chart.chartattr.Chart;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
@ -24,7 +23,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
private JPanel seriesPane; private JPanel seriesPane;
protected VanChartCustomPlotSeriesTabPane plotSeriesPane; protected VanChartCustomPlotSeriesTabPane plotSeriesPane;
private ChartFillStylePane fillStylePane;//配色 private VanChartFillStylePane fillStylePane;//配色
private VanChartBeautyPane stylePane;//风格 private VanChartBeautyPane stylePane;//风格
@ -81,7 +80,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,5));
return panel; return panel;
} }

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java

@ -29,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p}; double[] rowSize = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gradient_Style")), styleBox},
} ; } ;
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -37,17 +37,17 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
} }
protected String[] getNameArray(){ protected String[] getNameArray(){
return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"), return new String[]{Toolkit.i18nText("Fine-Design_Chart_On"),
Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade") Toolkit.i18nText("Fine-Design_Chart_Off")
}; };
} }
@Override @Override
public void populateBean(Integer ob) { public void populateBean(Integer ob) {
int finalIndex; int finalIndex;
switch (ob){ switch (ob){
case ChartConstants.STYLE_NONE: finalIndex = 0; break; case ChartConstants.STYLE_NONE: finalIndex = 1; break;
case ChartConstants.STYLE_SHADE: finalIndex = 1; break; case ChartConstants.STYLE_SHADE: finalIndex = 0; break;
default: finalIndex = 0; default: finalIndex = 1;
} }
styleBox.setSelectedIndex(finalIndex); styleBox.setSelectedIndex(finalIndex);
} }
@ -57,8 +57,8 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
int index = styleBox.getSelectedIndex(); int index = styleBox.getSelectedIndex();
int style; int style;
switch (index){ switch (index){
case 0: style = ChartConstants.STYLE_NONE; break; case 0: style = ChartConstants.STYLE_SHADE; break;
case 1: style = ChartConstants.STYLE_SHADE; break; case 1: style = ChartConstants.STYLE_NONE; break;
default: style = ChartConstants.STYLE_NONE; default: style = ChartConstants.STYLE_NONE;
} }
return style; return style;

218
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -1,42 +1,236 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.component.combobox.ColorSchemeComboBox;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Created by mengao on 2017/8/17. * Created by mengao on 2017/8/17.
*/ */
public class VanChartFillStylePane extends ChartFillStylePane { public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
protected ColorSchemeComboBox styleSelectBox;
protected JPanel customPane;
protected JPanel changeColorSetPane;
protected FixedGradientBar colorGradient;
protected CardLayout cardLayout;
protected ChartColorAdjustPane colorAdjustPane;
private Color[] gradientColors;
private Color[] accColors;
private boolean gradientSelect = false;
public VanChartFillStylePane() {
this.setLayout(new BorderLayout());
styleSelectBox = new ColorSchemeComboBox();
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER};
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
accColors = ChartColorAdjustPane.DEFAULT_COLORS;
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener();
initLayout();
}
private void initListener() {
colorAdjustPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
accColors = colorAdjustPane.getColors();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.COMBINATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
VanChartFillStylePane.this.revalidate();
}
});
colorGradient.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner();
gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.GRADATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
}
}
});
styleSelectBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
colorAdjustPane.updateColor(accColors);
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
break;
case GRADATION_COLOR:
colorGradient.updateColor(gradientColors[0], gradientColors[1]);
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
break;
default:
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
if (selectColorInfo.isGradient()) {
colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1));
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
} else {
colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{}));
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
}
break;
}
VanChartFillStylePane.this.revalidate();
}
});
}
protected void initLayout() {
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER);
}
@Override @Override
protected JPanel getContentPane () { public Dimension getPreferredSize() {
if (gradientSelect) {
return new Dimension(225, 80);
}
return super.getPreferredSize();
}
protected JPanel getContentPane() {
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[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color_Match")),styleSelectBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox},
new Component[]{null,customPane}, new Component[]{null, customPane},
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
return panel; return panel;
} }
@Override @Override
public Dimension getPreferredSize() { protected String title4PopupWindow() {
if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color");
return new Dimension(styleSelectBox.getPreferredSize().width, 30); }
@Override
public void populateBean(AttrFillStyle condition) {
String fillStyleName = condition == null ? "" : condition.getFillStyleName();
if (StringUtils.isBlank(fillStyleName)) {//兼容处理
if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
} else {
int colorStyle = condition.getColorStyle();
if (colorStyle == ChartConstants.COLOR_GRADIENT) {
gradientColors[0] = condition.getColorIndex(0);
gradientColors[1] = condition.getColorIndex(1);
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
} else {
int colorSize = condition.getColorSize();
accColors = new Color[colorSize];
for (int i = 0; i < colorSize; i++) {
accColors[i] = condition.getColorIndex(i);
}
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
}
} else {
styleSelectBox.setSelectedItem(fillStyleName);
}
}
@Override
public AttrFillStyle updateBean() {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
return updateCombinationColor();
case GRADATION_COLOR:
return updateGradationColor();
case DEFAULT:
return updateDefaultColor();
default:
return updateNormalColor();
}
}
private AttrFillStyle updateCombinationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_ACC);
for (int i = 0, length = accColors.length; i < length; i++) {
condition.addFillColor(accColors[i]);
}
condition.setCustomFillStyle(true);
return condition;
}
private AttrFillStyle updateGradationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_GRADIENT);
Color start = gradientColors[0];
Color end = gradientColors[1];
condition.addFillColor(start);
condition.addFillColor(end);
condition.setCustomFillStyle(true);
return condition;
}
private AttrFillStyle updateDefaultColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_DEFAULT);
return condition;
}
private AttrFillStyle updateNormalColor() {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem());
if (preStyle instanceof ChartColorMatching) {
AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle);
def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem()));
return def;
} else {
return updateDefaultColor();
} }
return super.getPreferredSize();
} }
} }

27
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java

@ -10,8 +10,8 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
@ -23,7 +23,6 @@ import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.van.chart.custom.style.VanChartCustomStylePane; import com.fr.van.chart.custom.style.VanChartCustomStylePane;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane; import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane;
import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartBeautyPane;
@ -62,6 +61,8 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
private VanChartBorderPane borderPane;//边框 private VanChartBorderPane borderPane;//边框
protected VanChartFillStylePane vanChartFillStylePane;//配色
private UINumberDragPane transparent;//不透明度 private UINumberDragPane transparent;//不透明度
protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸 protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸
@ -86,18 +87,18 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
} }
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
if (fillStylePane != null) { JPanel colorPane = getColorPane();
panel.add(fillStylePane, BorderLayout.NORTH); if(colorPane != null) {
panel.add(colorPane, BorderLayout.NORTH);
} }
panel.add(getContentInPlotType(), BorderLayout.CENTER); panel.add(getContentInPlotType(), BorderLayout.CENTER);
return panel; return panel;
} }
@Override
/** /**
* 返回 填充界面. * 返回 填充界面.
*/ */
protected ChartFillStylePane getFillStylePane() { protected VanChartFillStylePane getVanChartFillStylePane() {
//如果是自定義組合圖,則不創建填充界面 //如果是自定義組合圖,則不創建填充界面
return parentPane instanceof VanChartCustomStylePane ? null : new VanChartFillStylePane(); return parentPane instanceof VanChartCustomStylePane ? null : new VanChartFillStylePane();
} }
@ -111,9 +112,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
protected JPanel getColorPane() { protected JPanel getColorPane() {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
stylePane = createStylePane(); stylePane = createStylePane();
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
}
setColorPaneContent(panel); setColorPaneContent(panel);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return panel.getComponentCount() == 0 ? null : colorPane; return panel.getComponentCount() == 0 ? null : colorPane;
} }
@ -266,7 +271,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
checkoutMapType(plot); checkoutMapType(plot);
super.populateBean(plot);//配色 if(vanChartFillStylePane != null) { //配色
vanChartFillStylePane.populateBean(plot.getPlotFillStyle());
}
if (stylePane != null) {//风格 if (stylePane != null) {//风格
stylePane.populateBean(plot.getPlotStyle()); stylePane.populateBean(plot.getPlotStyle());
@ -323,7 +330,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
//更新之前先更新界面的map类型属性 //更新之前先更新界面的map类型属性
checkoutMapType(plot); checkoutMapType(plot);
super.updateBean(plot);//配色 if(vanChartFillStylePane != null) {//配色
plot.setPlotFillStyle(vanChartFillStylePane.updateBean());
}
if (stylePane != null) {//风格 if (stylePane != null) {//风格
plot.setPlotStyle(stylePane.updateBean()); plot.setPlotStyle(stylePane.updateBean());

1
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java

@ -31,7 +31,6 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; double[] rowSize = {p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createFunnelStylePane()}, new Component[]{createFunnelStylePane()},
new Component[]{createBorderPane()}, new Component[]{createBorderPane()},
}; };

6
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java

@ -13,6 +13,7 @@ import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.gantt.VanChartGanttPlot; import com.fr.plugin.chart.gantt.VanChartGanttPlot;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
@ -121,4 +122,9 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
} }
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
} }

9
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.frpane.UINumberDragPane;
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.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
@ -13,8 +14,6 @@ import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithFormula
import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane; import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.attr.GaugeDetailStyle;
import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
@ -22,6 +21,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -306,4 +306,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
colorPickerPane.updateBean(detailStyle.getHotAreaColor()); colorPickerPane.updateBean(detailStyle.getHotAreaColor());
} }
} }
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
} }

5
designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java

@ -9,10 +9,9 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFillStylePane;
import com.fr.van.chart.map.VanChartMapSeriesPane; import com.fr.van.chart.map.VanChartMapSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -41,7 +40,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane {
/** /**
* 返回 填充界面. * 返回 填充界面.
*/ */
protected ChartFillStylePane getFillStylePane() { protected VanChartFillStylePane getVanChartFillStylePane() {
return null; return null;
} }

6
designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java

@ -4,6 +4,7 @@ import com.fr.chart.chartattr.Plot;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -38,4 +39,9 @@ public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane {
return contentPane; return contentPane;
} }
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
} }

51
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -6,6 +6,7 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
@ -36,6 +37,7 @@ import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane;
import com.fr.van.chart.map.line.VanChartCurvePane; import com.fr.van.chart.map.line.VanChartCurvePane;
import com.fr.van.chart.map.line.VanChartLineMapEffectPane; import com.fr.van.chart.map.line.VanChartLineMapEffectPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -157,6 +159,35 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
} }
@Override
protected JPanel getContentPane(boolean custom) {
JPanel panel = new JPanel(new BorderLayout());
mapType = ((VanChartMapPlot) plot).getAllLayersMapType();
if(mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) {
vanChartFillStylePane = getVanChartFillStylePane();
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
}
panel.add(getContentInPlotType(), BorderLayout.CENTER);
return panel;
}
//获取颜色面板
private JPanel getColorPane(MapType paneType) {
JPanel panel = new JPanel(new BorderLayout());
stylePane = createStylePane();
mapType = ((VanChartMapPlot) plot).getAllLayersMapType();
if(mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) {
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
}
}
setColorPaneContent(panel, paneType);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return panel.getComponentCount() == 0 ? null : colorPane;
}
/** /**
* 在每个不同类型Plot, 得到不同类型的属性. 比如: 柱形的风格, 折线的线型曲线. * 在每个不同类型Plot, 得到不同类型的属性. 比如: 柱形的风格, 折线的线型曲线.
*/ */
@ -176,10 +207,17 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
//设置色彩面板内容 //设置色彩面板内容
protected void setColorPaneContent(JPanel panel) { protected void setColorPaneContent(JPanel panel, MapType paneType) {
panel.add(createNullValueColorPane(), BorderLayout.CENTER); switch (paneType) {
panel.add(createAlphaPane(), BorderLayout.SOUTH); case AREA:
panel.add(createNullValueColorPane(), BorderLayout.CENTER);
panel.add(createAlphaPane(), BorderLayout.SOUTH);
break;
case POINT:
panel.add(createPointAlphaPane(), BorderLayout.CENTER);
default:
return;
}
} }
@ -192,7 +230,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()}, new Component[]{getColorPane(MapType.AREA)},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)},
}; };
@ -213,7 +251,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), createPointAlphaPane())}, new Component[]{getColorPane(MapType.POINT)},
new Component[]{createMarkerComPane()}, new Component[]{createMarkerComPane()},
//大数据模式 恢复用注释。下面1行删除。 //大数据模式 恢复用注释。下面1行删除。
new Component[]{createLargeDataModelPane()}, new Component[]{createLargeDataModelPane()},
@ -232,6 +270,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
curvePane = new VanChartCurvePane(); curvePane = new VanChartCurvePane();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane(MapType.LINE)},
new Component[]{createCurvePane()}, new Component[]{createCurvePane()},
//大数据模式 恢复用注释。下面1行删除。 //大数据模式 恢复用注释。下面1行删除。
new Component[]{createLineMapLargeDataModelPane()}, new Component[]{createLineMapLargeDataModelPane()},

7
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java

@ -7,9 +7,9 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.pie.VanChartPieSeriesPane; import com.fr.van.chart.pie.VanChartPieSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -90,4 +90,9 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane {
multiPiePlot.setSupportRotation(supportRotation.getSelectedIndex() == 0); multiPiePlot.setSupportRotation(supportRotation.getSelectedIndex() == 0);
} }
} }
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
} }

1
designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java

@ -41,7 +41,6 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p}; double[] rowSize = {p,p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createSeriesStylePane(rowSize, new double[]{f, e})}, new Component[]{createSeriesStylePane(rowSize, new double[]{f, e})},
new Component[]{createBorderPane()}, new Component[]{createBorderPane()},
}; };

5
designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java

@ -43,7 +43,6 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[][] getPaneComponents() { private Component[][] getPaneComponents() {
if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) { if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) {
return new Component[][]{ return new Component[][]{
new Component[]{getColorPane()},
new Component[]{createRadarTypePane()}, new Component[]{createRadarTypePane()},
new Component[]{createBorderPane()}, new Component[]{createBorderPane()},
}; };
@ -59,7 +58,9 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane {
//设置色彩面板内容 //设置色彩面板内容
protected void setColorPaneContent (JPanel panel) { protected void setColorPaneContent (JPanel panel) {
panel.add(createAlphaPane(), BorderLayout.CENTER); if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) {
panel.add(createAlphaPane(), BorderLayout.CENTER);
}
} }
private JPanel createRadarTypePane() { private JPanel createRadarTypePane() {

1
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java

@ -35,7 +35,6 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createLineTypePane()}, new Component[]{createLineTypePane()},
new Component[]{createMarkerPane()}, new Component[]{createMarkerPane()},
new Component[]{createStackedAndAxisPane()}, new Component[]{createStackedAndAxisPane()},

7
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java

@ -10,10 +10,10 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.base.AttrNode; import com.fr.plugin.chart.base.AttrNode;
import com.fr.plugin.chart.structure.VanChartStructurePlot; import com.fr.plugin.chart.structure.VanChartStructurePlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -142,4 +142,9 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane
} }
} }
} }
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
} }

7
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java

@ -15,10 +15,10 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.plugin.chart.wordcloud.CloudShapeType; import com.fr.plugin.chart.wordcloud.CloudShapeType;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -228,4 +228,9 @@ public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane
} }
} }
} }
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
} }

Loading…
Cancel
Save