forked from fanruan/design
bryant
4 years ago
28 changed files with 409 additions and 86 deletions
@ -0,0 +1,26 @@ |
|||||||
|
package com.fr.design.data.datapane; |
||||||
|
|
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
import static org.junit.Assert.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Yyming |
||||||
|
* @version 10.0 |
||||||
|
* Created by Yyming on 2020/9/29 |
||||||
|
*/ |
||||||
|
public class TableDataPaneListPaneTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void rename() { |
||||||
|
TableDataPaneListPane listPane = new TableDataPaneListPane(); |
||||||
|
listPane.rename("111", "222"); |
||||||
|
listPane.rename("222", "333"); |
||||||
|
Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap(); |
||||||
|
assertEquals(1, dsNameChangedMap.size()); |
||||||
|
listPane.rename("333","111"); |
||||||
|
assertEquals(0, dsNameChangedMap.size()); |
||||||
|
} |
||||||
|
} |
@ -1,58 +1,210 @@ |
|||||||
package com.fr.van.chart.designer.component.border; |
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.Marker; |
||||||
import com.fr.chart.chartglyph.MarkerFactory; |
import com.fr.chart.chartglyph.MarkerFactory; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.icombobox.LineComboBox; |
||||||
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.xcombox.MarkerComboBox; |
import com.fr.design.gui.xcombox.MarkerComboBox; |
||||||
import com.fr.design.i18n.Toolkit; |
import com.fr.design.i18n.Toolkit; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.style.color.ColorSelectBox; |
||||||
import com.fr.design.utils.gui.UIComponentUtils; |
import com.fr.design.utils.gui.UIComponentUtils; |
||||||
import com.fr.design.widget.FRWidgetFactory; |
import com.fr.design.widget.FRWidgetFactory; |
||||||
import com.fr.plugin.chart.base.AttrBorderWithShape; |
import com.fr.plugin.chart.base.AttrBorderWithShape; |
||||||
import com.fr.plugin.chart.marker.type.MarkerType; |
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.Component; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
|
||||||
public class VanChartBorderWithShapePane extends VanChartBorderWithRadiusPane { |
public class VanChartBorderWithShapePane extends BasicPane { |
||||||
|
private static final int RECTANGULAR_INDEX = 0; |
||||||
|
private static final int DIALOG_INDEX = 1; |
||||||
|
|
||||||
private MarkerComboBox shapePane; |
private static final int AUTO_COLOR = 0; |
||||||
|
private static final int CUSTOM_COLOR = 1; |
||||||
|
|
||||||
protected void initComponents() { |
private LineComboBox lineTypeBox; |
||||||
shapePane = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers()); |
private UIButtonGroup<Integer> lineColorButton; |
||||||
super.initComponents(); |
private ColorSelectBox lineColorBox; |
||||||
|
private MarkerComboBox borderShape; |
||||||
|
private UISpinner borderRadius; |
||||||
|
|
||||||
|
private JPanel detailPane; |
||||||
|
private JPanel colorBoxPane; |
||||||
|
|
||||||
|
public VanChartBorderWithShapePane() { |
||||||
|
initComponents(); |
||||||
|
createBorderPane(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponents() { |
||||||
|
lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); |
||||||
|
lineColorButton = new UIButtonGroup<>(new String[]{ |
||||||
|
Toolkit.i18nText("Fine-Design_Chart_Automatic"), |
||||||
|
Toolkit.i18nText("Fine-Design_Chart_Custom") |
||||||
|
}); |
||||||
|
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(); |
||||||
|
initLineColorListener(); |
||||||
|
initShapeListener(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initLineTypeListener() { |
||||||
|
lineTypeBox.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkDetailPane(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkDetailPane() { |
||||||
|
detailPane.setVisible(lineTypeBox.getSelectedLineStyle() != Constants.LINE_NONE); |
||||||
} |
} |
||||||
|
|
||||||
protected Component[][] getUseComponent() { |
private void initLineColorListener() { |
||||||
return new Component[][]{ |
lineColorButton.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkColorPane(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkColorPane() { |
||||||
|
colorBoxPane.setVisible(lineColorButton.getSelectedIndex() == CUSTOM_COLOR); |
||||||
|
} |
||||||
|
|
||||||
|
private void initShapeListener() { |
||||||
|
borderShape.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkRadiusPane(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkRadiusPane() { |
||||||
|
borderRadius.setEnabled(borderShape.getSelectedIndex() == RECTANGULAR_INDEX || borderShape.getSelectedIndex() == DIALOG_INDEX); |
||||||
|
} |
||||||
|
|
||||||
|
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[]{null, null}, |
||||||
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), |
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), |
||||||
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)}, |
UIComponentUtils.wrapWithBorderLayoutPane(lineTypeBox)}}; |
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), currentLineColorPane}, |
|
||||||
|
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createDetailPane() { |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||||
|
|
||||||
|
double[] columnSize = {f, e}; |
||||||
|
double[] rowSize = {p, p, p}; |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null, null}, |
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), |
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), |
||||||
UIComponentUtils.wrapWithBorderLayoutPane(shapePane)}, |
UIComponentUtils.wrapWithBorderLayoutPane(borderShape)}, |
||||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), getRadius()} |
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), borderRadius} |
||||||
}; |
}; |
||||||
|
|
||||||
|
JPanel center = createLineColorPane(); |
||||||
|
JPanel south = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||||
|
|
||||||
|
JPanel panel = new JPanel(new BorderLayout()); |
||||||
|
|
||||||
|
panel.add(center, BorderLayout.CENTER); |
||||||
|
panel.add(south, BorderLayout.SOUTH); |
||||||
|
|
||||||
|
return panel; |
||||||
} |
} |
||||||
|
|
||||||
protected double[] getRowSize() { |
private JPanel createLineColorPane() { |
||||||
double p = TableLayout.PREFERRED; |
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}; |
||||||
|
|
||||||
|
Component[][] center = new Component[][]{ |
||||||
|
new Component[]{null, null}, |
||||||
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), lineColorButton} |
||||||
|
}; |
||||||
|
|
||||||
|
Component[][] south = new Component[][]{ |
||||||
|
new Component[]{null, null}, |
||||||
|
new Component[]{null, lineColorBox} |
||||||
|
}; |
||||||
|
|
||||||
|
colorBoxPane = TableLayout4VanChartHelper.createGapTableLayoutPane(south, rowSize, columnSize); |
||||||
|
|
||||||
|
JPanel panel = new JPanel(new BorderLayout()); |
||||||
|
|
||||||
|
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(center, rowSize, columnSize), BorderLayout.CENTER); |
||||||
|
panel.add(colorBoxPane, BorderLayout.SOUTH); |
||||||
|
|
||||||
|
return panel; |
||||||
} |
} |
||||||
|
|
||||||
public void populate(AttrBorder border) { |
protected String title4PopupWindow() { |
||||||
super.populate(border); |
return null; |
||||||
|
} |
||||||
|
|
||||||
if (border instanceof AttrBorderWithShape) { |
public void populate(AttrBorderWithShape border) { |
||||||
shapePane.setSelectedMarker((Marker.createMarker(((AttrBorderWithShape) border).getShape()))); |
if (border == null) { |
||||||
|
return; |
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
public void update(AttrBorder border) { |
lineTypeBox.setSelectedLineStyle(border.getBorderStyle()); |
||||||
super.update(border); |
lineColorButton.setSelectedIndex(border.isAutoColor() ? AUTO_COLOR : CUSTOM_COLOR); |
||||||
|
lineColorBox.setSelectObject(border.getBorderColor()); |
||||||
|
borderShape.setSelectedMarker((Marker.createMarker(border.getShape()))); |
||||||
|
borderRadius.setValue(border.getRoundRadius()); |
||||||
|
|
||||||
if (border instanceof AttrBorderWithShape) { |
checkDetailPane(); |
||||||
((AttrBorderWithShape) border).setShape(MarkerType.parse(shapePane.getSelectedMarkder().getMarkerType())); |
checkColorPane(); |
||||||
|
checkRadiusPane(); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(AttrBorderWithShape border) { |
||||||
|
if (border == null) { |
||||||
|
return; |
||||||
} |
} |
||||||
|
|
||||||
|
border.setBorderStyle(lineTypeBox.getSelectedLineStyle()); |
||||||
|
border.setAutoColor(lineColorButton.getSelectedIndex() == AUTO_COLOR); |
||||||
|
border.setBorderColor(lineColorBox.getSelectObject()); |
||||||
|
border.setShape(MarkerType.parse(borderShape.getSelectedMarkder().getMarkerType())); |
||||||
|
border.setRoundRadius((int) borderRadius.getValue()); |
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue