|
|
|
@ -4,10 +4,12 @@ import com.fr.base.Utils;
|
|
|
|
|
import com.fr.base.background.ImageBackground; |
|
|
|
|
import com.fr.base.background.ImageFileBackground; |
|
|
|
|
import com.fr.chart.chartattr.Plot; |
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
|
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; |
|
|
|
@ -61,7 +63,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double[] columnSize = {f}; |
|
|
|
|
double[] rowSize = {p,p,p}; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{createWordCloudStylePane()}, |
|
|
|
|
}; |
|
|
|
@ -71,42 +73,43 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
return contentPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createWordCloudStylePane(){ |
|
|
|
|
private JPanel createWordCloudStylePane() { |
|
|
|
|
double labelSize = LABEL_SIZE; |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double[] centerC = {labelSize,f,p,f}; |
|
|
|
|
double[] centerC = {labelSize, f, p, f}; |
|
|
|
|
double[] centerR = {p}; |
|
|
|
|
|
|
|
|
|
minRotation = new UISpinner(-MAX_ROTATION,MAX_ROTATION,1,0); |
|
|
|
|
minRotation = new UISpinner(-MAX_ROTATION, MAX_ROTATION, 1, 0); |
|
|
|
|
maxRotation = new |
|
|
|
|
UISpinner(-MAX_ROTATION,MAX_ROTATION,1,0); |
|
|
|
|
UISpinner(-MAX_ROTATION, MAX_ROTATION, 1, 0); |
|
|
|
|
Component[][] centerComps = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation_Angle")), minRotation, |
|
|
|
|
new UILabel("-"), maxRotation}, |
|
|
|
|
}; |
|
|
|
|
JPanel centerPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(centerComps,centerR,centerC); |
|
|
|
|
JPanel centerPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(centerComps, centerR, centerC); |
|
|
|
|
|
|
|
|
|
double[] northC = {f, e}; |
|
|
|
|
double[] northR = {p,p}; |
|
|
|
|
double[] northR = {p, p}; |
|
|
|
|
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
|
|
|
|
defineFontSize = new UIButtonGroup(new String[]{AUTO_FONT_SIZE, CUSTOM_FONT_SIZE}); |
|
|
|
|
Component[][] northComps = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font")), fontNameComboBox}, |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")), defineFontSize } |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")), defineFontSize} |
|
|
|
|
}; |
|
|
|
|
JPanel northPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(northComps,northR,northC); |
|
|
|
|
JPanel northPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(northComps, northR, northC); |
|
|
|
|
|
|
|
|
|
minFontSize = new UISpinner(0,Double.MAX_VALUE,1,10); |
|
|
|
|
maxFontSize = new UISpinner(0,Double.MAX_VALUE,1,100); |
|
|
|
|
minFontSize = new UISpinnerWithPx(10); |
|
|
|
|
maxFontSize = new UISpinnerWithPx(100); |
|
|
|
|
Component[][] fontComps = new Component[][]{ |
|
|
|
|
new Component[]{null, minFontSize, |
|
|
|
|
new UILabel("-"), maxFontSize}, |
|
|
|
|
}; |
|
|
|
|
fontPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(fontComps,centerR,centerC); |
|
|
|
|
fontPanel = TableLayoutHelper.createGapTableLayoutPane(fontComps, centerR, centerC, |
|
|
|
|
6, LayoutConstants.VGAP_LARGE); |
|
|
|
|
|
|
|
|
|
double[] columnSize = {f}; |
|
|
|
|
double[] rowSize = {p, p, p, p}; |
|
|
|
@ -132,27 +135,27 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
|
|
|
|
|
private JPanel createCloudShapePane() { |
|
|
|
|
cloudShape = new UIComboBox(CloudShapeType.getTypes()); |
|
|
|
|
imageBackgroundQuickPane = new ImageBackgroundQuickPane(false){ |
|
|
|
|
imageBackgroundQuickPane = new ImageBackgroundQuickPane(false) { |
|
|
|
|
@Override |
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
if(cloudShape.getSelectedItem() == CloudShapeType.DEFAULT){ |
|
|
|
|
return new Dimension(0,0); |
|
|
|
|
if (cloudShape.getSelectedItem() == CloudShapeType.DEFAULT) { |
|
|
|
|
return new Dimension(0, 0); |
|
|
|
|
} else { |
|
|
|
|
return super.getPreferredSize(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
JPanel panel = new JPanel(new BorderLayout(0,4)); |
|
|
|
|
JPanel panel = new JPanel(new BorderLayout(0, 4)); |
|
|
|
|
panel.add(cloudShape, BorderLayout.NORTH); |
|
|
|
|
panel.add(imageBackgroundQuickPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
cloudShape.addItemListener(new ItemListener() { |
|
|
|
|
@Override |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
CloudShapeType type = (CloudShapeType)cloudShape.getSelectedItem(); |
|
|
|
|
CloudShapeType type = (CloudShapeType) cloudShape.getSelectedItem(); |
|
|
|
|
String path = type.getImageUrl(); |
|
|
|
|
if(path != null) { |
|
|
|
|
if (path != null) { |
|
|
|
|
ImageFileBackground imageBackground = new ImageFileBackground(IOUtils.readImage(path)); |
|
|
|
|
imageBackgroundQuickPane.populateBean(imageBackground); |
|
|
|
|
} else { |
|
|
|
@ -181,8 +184,8 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(Plot plot) { |
|
|
|
|
super.populateBean(plot); |
|
|
|
|
if(plot instanceof VanChartWordCloudPlot){ |
|
|
|
|
VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot)plot; |
|
|
|
|
if (plot instanceof VanChartWordCloudPlot) { |
|
|
|
|
VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot) plot; |
|
|
|
|
fontNameComboBox.setSelectedItem(wordCloudPlot.getFont().getFamily()); |
|
|
|
|
minRotation.setValue(wordCloudPlot.getMinRotation()); |
|
|
|
|
maxRotation.setValue(wordCloudPlot.getMaxRotation()); |
|
|
|
@ -193,7 +196,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
|
|
|
|
|
cloudShape.setSelectedItem(wordCloudPlot.getShapeType()); |
|
|
|
|
ImageBackground imageBackground = wordCloudPlot.getShapeImage(); |
|
|
|
|
if(imageBackground != null) { |
|
|
|
|
if (imageBackground != null) { |
|
|
|
|
imageBackgroundQuickPane.populateBean(imageBackground); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -209,8 +212,8 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
@Override |
|
|
|
|
public void updateBean(Plot plot) { |
|
|
|
|
super.updateBean(plot); |
|
|
|
|
if(plot instanceof VanChartWordCloudPlot){ |
|
|
|
|
VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot)plot; |
|
|
|
|
if (plot instanceof VanChartWordCloudPlot) { |
|
|
|
|
VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot) plot; |
|
|
|
|
wordCloudPlot.setFont(FRFont.getInstance(fontNameComboBox.getSelectedItem().toString(), Font.PLAIN, 9)); |
|
|
|
|
wordCloudPlot.setMinRotation(minRotation.getValue()); |
|
|
|
|
wordCloudPlot.setMaxRotation(maxRotation.getValue()); |
|
|
|
@ -220,7 +223,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
wordCloudPlot.setMaxFontSize(maxFontSize.getValue()); |
|
|
|
|
|
|
|
|
|
wordCloudPlot.setShapeType((CloudShapeType) cloudShape.getSelectedItem()); |
|
|
|
|
if(wordCloudPlot.getShapeType() != CloudShapeType.DEFAULT) { |
|
|
|
|
if (wordCloudPlot.getShapeType() != CloudShapeType.DEFAULT) { |
|
|
|
|
wordCloudPlot.setShapeImage((ImageBackground) imageBackgroundQuickPane.updateBean()); |
|
|
|
|
} else { |
|
|
|
|
wordCloudPlot.setShapeImage(null); |
|
|
|
|