Qinghui.Liu
4 years ago
1 changed files with 100 additions and 25 deletions
@ -1,58 +1,133 @@
|
||||
package com.fr.van.chart.designer.component.border; |
||||
|
||||
import com.fr.chart.base.AttrBorder; |
||||
import com.fr.chart.chartglyph.Marker; |
||||
import com.fr.chart.chartglyph.MarkerFactory; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icombobox.LineComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.xcombox.MarkerComboBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.design.utils.gui.UIComponentUtils; |
||||
import com.fr.design.widget.FRWidgetFactory; |
||||
import com.fr.plugin.chart.base.AttrBorderWithShape; |
||||
import com.fr.plugin.chart.marker.type.MarkerType; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.stable.CoreConstants; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class VanChartBorderWithShapePane extends VanChartBorderWithRadiusPane { |
||||
public class VanChartBorderWithShapePane extends BasicPane { |
||||
|
||||
private MarkerComboBox shapePane; |
||||
private LineComboBox lineTypeBox; |
||||
private ColorSelectBox lineColorBox; |
||||
private MarkerComboBox borderShape; |
||||
private UISpinner borderRadius; |
||||
|
||||
protected void initComponents() { |
||||
shapePane = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers()); |
||||
super.initComponents(); |
||||
private JPanel detailPane; |
||||
|
||||
public VanChartBorderWithShapePane() { |
||||
initComponents(); |
||||
createBorderPane(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); |
||||
lineColorBox = new ColorSelectBox(100); |
||||
borderShape = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers()); |
||||
borderRadius = new UISpinner(0, 1000, 1, 0); |
||||
} |
||||
|
||||
private void createBorderPane() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
detailPane = createDetailPane(); |
||||
|
||||
this.add(createLineTypePane(), BorderLayout.CENTER); |
||||
this.add(detailPane, BorderLayout.SOUTH); |
||||
|
||||
initLineTypeListener(); |
||||
} |
||||
|
||||
protected Component[][] getUseComponent() { |
||||
return new Component[][]{ |
||||
private void initLineTypeListener() { |
||||
lineTypeBox.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkDetailPane(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkDetailPane() { |
||||
detailPane.setVisible(lineTypeBox.getSelectedLineStyle() != Constants.LINE_NONE); |
||||
} |
||||
|
||||
private JPanel createLineTypePane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
|
||||
double[] columnSize = {f, e}; |
||||
double[] rowSize = {p, p}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), |
||||
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), currentLineColorPane}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), |
||||
UIComponentUtils.wrapWithBorderLayoutPane(shapePane)}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), getRadius()} |
||||
}; |
||||
UIComponentUtils.wrapWithBorderLayoutPane(lineTypeBox)}}; |
||||
|
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
protected double[] getRowSize() { |
||||
private JPanel createDetailPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
return new double[]{p, p, p, p, p}; |
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
|
||||
double[] columnSize = {f, e}; |
||||
double[] rowSize = {p, p, p, p}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), lineColorBox}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), |
||||
UIComponentUtils.wrapWithBorderLayoutPane(borderShape)}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), borderRadius} |
||||
}; |
||||
|
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
public void populate(AttrBorder border) { |
||||
super.populate(border); |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
if (border instanceof AttrBorderWithShape) { |
||||
shapePane.setSelectedMarker((Marker.createMarker(((AttrBorderWithShape) border).getShape()))); |
||||
public void populate(AttrBorderWithShape border) { |
||||
if (border == null) { |
||||
return; |
||||
} |
||||
} |
||||
|
||||
public void update(AttrBorder border) { |
||||
super.update(border); |
||||
lineTypeBox.setSelectedLineStyle(border.getBorderStyle()); |
||||
lineColorBox.setSelectObject(border.getBorderColor()); |
||||
borderShape.setSelectedMarker((Marker.createMarker(border.getShape()))); |
||||
borderRadius.setValue(border.getRoundRadius()); |
||||
|
||||
if (border instanceof AttrBorderWithShape) { |
||||
((AttrBorderWithShape) border).setShape(MarkerType.parse(shapePane.getSelectedMarkder().getMarkerType())); |
||||
checkDetailPane(); |
||||
} |
||||
|
||||
public void update(AttrBorderWithShape border) { |
||||
if (border == null) { |
||||
return; |
||||
} |
||||
|
||||
border.setBorderStyle(lineTypeBox.getSelectedLineStyle()); |
||||
border.setBorderColor(lineColorBox.getSelectObject()); |
||||
border.setShape(MarkerType.parse(borderShape.getSelectedMarkder().getMarkerType())); |
||||
border.setRoundRadius((int) borderRadius.getValue()); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue