47 changed files with 740 additions and 215 deletions
@ -0,0 +1,20 @@ |
|||||||
|
package com.fr.design.mainframe; |
||||||
|
|
||||||
|
import javax.swing.JWindow; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: Yuan.Wang |
||||||
|
* @Date: 2020/10/9 |
||||||
|
* 只关心Window的显示和隐藏操作时可以实现该接口 |
||||||
|
*/ |
||||||
|
public interface PromptWindow { |
||||||
|
/** |
||||||
|
* 显示弹窗 |
||||||
|
*/ |
||||||
|
void showWindow(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 隐藏弹窗 |
||||||
|
*/ |
||||||
|
void hideWindow(); |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.fr.design.notification; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: Yuan.Wang |
||||||
|
* @Date: 2020/9/27 |
||||||
|
*/ |
||||||
|
public abstract class AbstractSnapChat implements SnapChat { |
||||||
|
@Override |
||||||
|
public boolean hasRead() { |
||||||
|
|
||||||
|
String calcKey = calcKey(); |
||||||
|
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); |
||||||
|
return val == null ? defaultStatus() : val; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void markRead() { |
||||||
|
|
||||||
|
String calcKey = calcKey(); |
||||||
|
SnapChatConfig.getInstance().markRead(calcKey); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.fr.design.notification; |
||||||
|
|
||||||
|
import com.fr.plugin.context.PluginContext; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: Yuan.Wang |
||||||
|
* @Date: 2020/10/10 |
||||||
|
*/ |
||||||
|
public class SnapChatFactory { |
||||||
|
public static SnapChat createSnapChat(boolean defaultStatus, SnapChatKey snapChatKey) { |
||||||
|
return createSnapChat(defaultStatus, snapChatKey, null); |
||||||
|
} |
||||||
|
|
||||||
|
public static SnapChat createSnapChat(boolean defaultStatus, SnapChatKey snapChatKey, PluginContext context) { |
||||||
|
return new AbstractSnapChat() { |
||||||
|
@Override |
||||||
|
public boolean defaultStatus() { |
||||||
|
return defaultStatus; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public SnapChatKey key() { |
||||||
|
return snapChatKey; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String calcKey() { |
||||||
|
return context == null ? key().calc() : key().calc(context); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -1,9 +1,18 @@ |
|||||||
package com.fr.design.notification; |
package com.fr.design.notification; |
||||||
|
|
||||||
|
import com.fr.plugin.context.PluginContext; |
||||||
|
|
||||||
/** |
/** |
||||||
* created by Harrison on 2020/03/16 |
* created by Harrison on 2020/03/16 |
||||||
**/ |
**/ |
||||||
public interface SnapChatKey { |
public interface SnapChatKey { |
||||||
|
|
||||||
String calc(); |
String calc(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 插件刚被安装时不能通过PluginContexts.getContext()方法获取插件上下文,因此加一个接口 |
||||||
|
*/ |
||||||
|
default String calc(PluginContext context) { |
||||||
|
throw new UnsupportedOperationException(); |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -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; |
||||||
|
|
||||||
public void populate(AttrBorder border) { |
double[] columnSize = {f, e}; |
||||||
super.populate(border); |
double[] rowSize = {p, p}; |
||||||
|
|
||||||
if (border instanceof AttrBorderWithShape) { |
Component[][] center = new Component[][]{ |
||||||
shapePane.setSelectedMarker((Marker.createMarker(((AttrBorderWithShape) border).getShape()))); |
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; |
||||||
} |
} |
||||||
|
|
||||||
|
protected String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(AttrBorderWithShape border) { |
||||||
|
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