Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~henry.wang/design into release/10.0

feature/big-screen
Henry.Wang 4 years ago
parent
commit
ff61273178
  1. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  2. 108
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  3. 554
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  5. 61
      designer-base/src/main/java/com/fr/design/utils/ParameterUtils.java
  6. 38
      designer-base/src/test/java/com/fr/design/utils/ParameterUtilsTest.java
  7. 89
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  8. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  9. 5
      designer-realize/src/main/java/com/fr/poly/PolyDesigner.java
  10. 2
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -32,6 +32,7 @@ import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.ParameterUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.sql.SqlUtils; import com.fr.general.sql.SqlUtils;
@ -218,8 +219,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery);
List<ParameterProvider> existParameterList = editorPane.update(); List<ParameterProvider> existParameterList = editorPane.update();
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]); Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]);
editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps));
editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps));
} }
private JToolBar createToolBar() { private JToolBar createToolBar() {

108
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java

@ -19,6 +19,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -95,9 +96,8 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1)); centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1));
centerPanel.add(headLabel); centerPanel.add(headLabel);
Iterator<Entry<String, TableDataWrapper>> entryIt = resMap.entrySet().iterator(); for (Entry<String, TableDataWrapper> stringTableDataWrapperEntry : resMap.entrySet()) {
while (entryIt.hasNext()) { TableDataWrapper tableDataWrappe = stringTableDataWrapperEntry.getValue();
TableDataWrapper tableDataWrappe = entryIt.next().getValue();
String tmp = tableDataWrappe.getTableDataName(); String tmp = tableDataWrappe.getTableDataName();
if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) { if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) {
centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon())); centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon()));
@ -111,13 +111,10 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getPreviewActionListener() { private ActionListener getPreviewActionListener() {
return new ActionListener() { return e -> {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
public void actionPerformed(ActionEvent e) { td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
MultiTDTableData td = MultiTDTableDataPane.this.updateBean(); new TemplateTableDataWrapper(td).previewData();
td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
new TemplateTableDataWrapper(td).previewData();
}
}; };
} }
@ -126,12 +123,12 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
jpanel.setPreferredSize(new Dimension(-1, 150)); jpanel.setPreferredSize(new Dimension(-1, 150));
jpanel.setLayout(new BorderLayout()); jpanel.setLayout(new BorderLayout());
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() { editorPane = new UITableEditorPane<>(new ParameterTableModel() {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
return new UITableEditAction[]{new RefreshAction()}; return new UITableEditAction[]{new RefreshAction()};
} }
}, " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter")); }, StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter"));
jpanel.add(editorPane, BorderLayout.CENTER); jpanel.add(editorPane, BorderLayout.CENTER);
@ -162,29 +159,32 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
paramTexts[i] = (String) object[i]; paramTexts[i] = (String) object[i];
} }
List<ParameterProvider> existParameterList = new ArrayList<ParameterProvider>(); List<ParameterProvider> existParameterList = new ArrayList<>();
Iterator<Entry<String, String>> dataItera = choosenTableData.entrySet().iterator(); List<String> parameterName = new ArrayList<>();
List<String> parameterName = new ArrayList<String>(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (dataItera.hasNext()) { TableData td = resMap.get(entry.getKey()).getTableData();
Entry<String, String> entry = dataItera.next(); ParameterProvider[] currentParameters = td.getParameters(Calculator.createCalculator());
TableData td = resMap.get(entry.getKey()).getTableData(); for (ParameterProvider currentParameter : currentParameters) {
ParameterProvider[] currentparameters = td.getParameters(Calculator.createCalculator()); if (parameterName.contains(currentParameter.getName())) {
for (int i=0; i<currentparameters.length; i++){ continue;
if (parameterName.contains(currentparameters[i].getName())){ }
continue; parameterName.add(currentParameter.getName());
} try {
parameterName.add(currentparameters[i].getName()); //采用给新的界面刷新参数时,clone一个值过去,不然会出现联动修改
existParameterList.add(currentparameters[i]); existParameterList.add((ParameterProvider) currentParameter.clone());
} } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
} }
ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true); ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true);
for (int i=0; i<texts.length; i++) { for (ParameterProvider text : texts) {
if (parameterName.contains(texts[i].getName())){ if (parameterName.contains(text.getName())) {
continue; continue;
} }
existParameterList.add(texts[i]); existParameterList.add(text);
} }
Parameter[] ps = existParameterList.toArray(new Parameter[existParameterList.size()]); ParameterProvider[] ps = existParameterList.toArray(new ParameterProvider[0]);
editorPane.populate(ps); editorPane.populate(ps);
existParameterList.clear(); existParameterList.clear();
parameterName.clear(); parameterName.clear();
@ -217,7 +217,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
String name; String name;
for (int i = 0; i < ob.getTableDataCount(); i++) { for (int i = 0; i < ob.getTableDataCount(); i++) {
name = ob.getTableDataName(i); name = ob.getTableDataName(i);
choosenTableData.put(name, ""); choosenTableData.put(name, StringUtils.EMPTY);
} }
} }
} }
@ -236,15 +236,13 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
@Override @Override
public MultiTDTableData updateBean() { public MultiTDTableData updateBean() {
ConditionTableData td = new ConditionTableData(); ConditionTableData td = new ConditionTableData();
Iterator<Entry<String, String>> it = choosenTableData.entrySet().iterator(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (it.hasNext()) {
Entry<String, String> entry = it.next();
td.addTableData(entry.getKey(), entry.getValue()); td.addTableData(entry.getKey(), entry.getValue());
} }
List<ParameterProvider> paramList = editorPane.update(); List<ParameterProvider> paramList = editorPane.update();
if (paramList != null) { if (paramList != null) {
td.setDefineParameters(paramList.toArray(new Parameter[paramList.size()])); td.setDefineParameters(paramList.toArray(new Parameter[0]));
} }
return td; return td;
@ -348,9 +346,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
chekbox.setSelected(false); chekbox.setSelected(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
if (choosenTableData.containsKey(name)) { choosenTableData.remove(name);
choosenTableData.remove(name);
}
} else { } else {
formulaButton.setEnabled(true); formulaButton.setEnabled(true);
formulaContentTextField.setEnabled(true); formulaContentTextField.setEnabled(true);
@ -372,9 +368,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} else { } else {
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
if (choosenTableData.containsKey(name)) { choosenTableData.remove(name);
choosenTableData.remove(name);
}
} }
} }
@ -388,22 +382,20 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getFormulaActionListener() { private ActionListener getFormulaActionListener() {
return new ActionListener() { return e -> {
public void actionPerformed(ActionEvent e) { final UIFormula formulaPane = FormulaFactory.createFormulaPane();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText()));
formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText())); formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() { public void doOk() {
public void doOk() { BaseFormula formula = formulaPane.update();
BaseFormula formula = formulaPane.update(); if (formula == null) {
if (formula == null) { formulaContentTextField.setText(StringUtils.EMPTY);
formulaContentTextField.setText(""); } else {
} else { formulaContentTextField.setText(formula.getContent().substring(1));
formulaContentTextField.setText(formula.getContent().substring(1));
}
MultiTDTableDataPane.this.refresh();
} }
}).setVisible(true); MultiTDTableDataPane.this.refresh();
} }
}).setVisible(true);
}; };
} }
} }

554
designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java

@ -9,14 +9,17 @@ import com.fr.stable.Constants;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -29,303 +32,312 @@ import java.awt.event.MouseEvent;
/** /**
* @author Jerry * @author Jerry
* 非模态悬浮对话框气泡形状 * 非模态悬浮对话框气泡形状
*/ */
public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
private static final long serialVersionUID = -6386018511442190959L; private static final long serialVersionUID = -6386018511442190959L;
private static int OFF_LEFT = 10; private static int OFF_LEFT = 10;
private static final int ARROR_PARALLEL = 30; private static final int ARROR_PARALLEL = 30;
private static final int ARROR_VERTICAL = 20; private static final int ARROR_VERTICAL = 20;
private static final int TITLE_HEIGHT = 60; private static final int TITLE_HEIGHT = 60;
private static final double TIME_DEFAULT = 0.5; private static final double TIME_DEFAULT = 0.5;
private static final double TIME_GAP = 0.1; private static final double TIME_GAP = 0.1;
private BasicBeanPane<T> contentPane; private BasicBeanPane<T> contentPane;
private Rectangle bounds; private Rectangle bounds;
private int arrowPosition; private int arrowPosition;
private double time = 0.5; private double time = 0.5;
private UIDialog showDialog; private UIDialog showDialog;
/** /**
* @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO * @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO
* @param arrowPoint 箭头的坐标点 * @param arrowPoint 箭头的坐标点
* @param contentPane 对话框中的Panel * @param contentPane 对话框中的Panel
*/ */
public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane) { public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane) {
this(arrowPosition, arrowPoint, contentPane, contentPane.getPreferredSize().width, contentPane.getPreferredSize().height); this(arrowPosition, arrowPoint, contentPane, contentPane.getPreferredSize().width, contentPane.getPreferredSize().height);
} }
/** /**
* 这个方法主要用于那些宽度和高度有变化的面板因为显然外面的气泡要固定大小不然忽大忽小体验太差了 * 这个方法主要用于那些宽度和高度有变化的面板因为显然外面的气泡要固定大小不然忽大忽小体验太差了
* *
* @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO * @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO
* @param arrowPoint 箭头的坐标点 * @param arrowPoint 箭头的坐标点
* @param contentPane 对话框中的Panel * @param contentPane 对话框中的Panel
* @param width 对话框中的Panel的宽度写死了 * @param width 对话框中的Panel的宽度写死了
* @param height 对话框中的Panel的高度写死了 * @param height 对话框中的Panel的高度写死了
*/ */
public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane, int width, int height) { public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane, int width, int height) {
this.contentPane = contentPane; this.contentPane = contentPane;
this.arrowPosition = arrowPosition; this.arrowPosition = arrowPosition;
this.time = initBoundsTime(arrowPosition, arrowPoint, width, height); this.time = initBoundsTime(arrowPosition, arrowPoint, width, height);
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y , width, height); this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y, width, height);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height);
} }
initComponents(); initComponents();
} }
/** /**
* show对话框 * show对话框
*
* @param fatherPane 上一层界面 parentPane * @param fatherPane 上一层界面 parentPane
* @param ob 传入的内容在show之前populate * @param ob 传入的内容在show之前populate
*/ */
public void show(JComponent fatherPane, T ob) { public void show(JComponent fatherPane, T ob) {
populateBean(ob); populateBean(ob);
UIDialog dialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); if (showDialog == null) {
showDialog = dialog; showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane));
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); }
dialog.setVisible(true); Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
} showDialog.setVisible(true);
}
/**
* 数据展现 /**
*/ * 数据展现
public void populateBean(T ob) { */
contentPane.populateBean(ob); public void populateBean(T ob) {
} contentPane.populateBean(ob);
}
/**
* 停止编辑, 更新至最新的面板到属性保存 /**
*/ * 停止编辑, 更新至最新的面板到属性保存
public T updateBean() { */
updateContentPane(); public T updateBean() {
return contentPane.updateBean(); updateContentPane();
} return contentPane.updateBean();
}
/**
* 需要实现更新内容将updateBean传值给对象即可在窗口消失的时候会被调用 /**
*/ * 需要实现更新内容将updateBean传值给对象即可在窗口消失的时候会被调用
protected abstract void updateContentPane(); */
protected abstract void updateContentPane();
/**
* 以对话框的形式弹出 /**
* * 以对话框的形式弹出
* @param window 窗口 *
* @return 对话框 * @param window 窗口
*/ * @return 对话框
public UIDialog showUnsizedWindow(Window window) { */
CustomShapedDialog dg = null; public UIDialog showUnsizedWindow(Window window) {
if (window instanceof Frame) { CustomShapedDialog dg = null;
dg = new CustomShapedDialog((Frame) window); if (window instanceof Frame) {
} else { dg = new CustomShapedDialog((Frame) window);
dg = new CustomShapedDialog((Dialog) window); } else {
} dg = new CustomShapedDialog((Dialog) window);
if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { }
dg.setSize(bounds.width + ARROR_PARALLEL, bounds.height + ARROR_VERTICAL); if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
} else { dg.setSize(bounds.width + ARROR_PARALLEL, bounds.height + ARROR_VERTICAL);
dg.setSize(bounds.width + ARROR_VERTICAL, bounds.height + ARROR_PARALLEL); } else {
} dg.setSize(bounds.width + ARROR_VERTICAL, bounds.height + ARROR_PARALLEL);
}
dg.setLocation(bounds.x, bounds.y);
dg.setBackground(Color.blue); dg.setLocation(bounds.x, bounds.y);
dg.setResizable(false); dg.setBackground(Color.blue);
return dg; dg.setResizable(false);
} return dg;
}
@Override
protected String title4PopupWindow() { @Override
return null; protected String title4PopupWindow() {
} return null;
}
private double initBoundsTime(int arrowPosition, Point arrowPoint, int width, int height) {
int x = arrowPoint.x; private double initBoundsTime(int arrowPosition, Point arrowPoint, int width, int height) {
int y = arrowPoint.y; int x = arrowPoint.x;
int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; int y = arrowPoint.y;
int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height - TITLE_HEIGHT; int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
double time = TIME_DEFAULT; int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height - TITLE_HEIGHT;
double time = TIME_DEFAULT;
if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
while (y + time * height > screenHeight && time > 0) { if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
time -= TIME_GAP; while (y + time * height > screenHeight && time > 0) {
} time -= TIME_GAP;
}
while (y - (1 - time) * height < 0 && time < 1) {
time += TIME_GAP; while (y - (1 - time) * height < 0 && time < 1) {
} time += TIME_GAP;
} else if (arrowPosition == Constants.TOP) { }
while (x + time * width > screenWidth && time > 0) { } else if (arrowPosition == Constants.TOP) {
time -= TIME_GAP; while (x + time * width > screenWidth && time > 0) {
} time -= TIME_GAP;
}
while (x - (1 - time) * width < 0 && time < 1) {
time += TIME_GAP; while (x - (1 - time) * width < 0 && time < 1) {
} time += TIME_GAP;
} }
return 1 - time; }
} return 1 - time;
}
private AWTEventListener awt = new AWTEventListener() {
public void eventDispatched(AWTEvent event) { private AWTEventListener awt = new AWTEventListener() {
doSomeInAll(event); public void eventDispatched(AWTEvent event) {
} doSomeInAll(event);
}; }
};
private void doSomeInAll(AWTEvent event) {
if (event instanceof MouseEvent) { private void doSomeInAll(AWTEvent event) {
MouseEvent mv = (MouseEvent) event; if (event instanceof MouseEvent) {
if (mv.getClickCount() > 0) { MouseEvent mv = (MouseEvent) event;
Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY()); if (mv.getClickCount() > 0) {
// 判断鼠标点击是否在边界内 Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY());
if (!containsPoint(point) && showDialog != null) { // 判断鼠标点击是否在边界内
updateContentPane(); if (!containsPoint(point) && showDialog != null) {
showDialog.setVisible(false); updateContentPane();
Toolkit.getDefaultToolkit().removeAWTEventListener(awt); showDialog.setVisible(false);
} Toolkit.getDefaultToolkit().removeAWTEventListener(awt);
} }
} }
} }
}
private boolean containsPoint(Point point) { private boolean containsPoint(Point point) {
if(arrowPosition == Constants.TOP){ if (arrowPosition == Constants.TOP) {
//箭头和按钮也算在pane内 //箭头和按钮也算在pane内
Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT); Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT);
return judgedBounds.contains(point); return judgedBounds.contains(point);
} }
return bounds.contains(point); return bounds.contains(point);
} }
private void initComponents() { private void initComponents() {
if(arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
this.setBounds(20, 10, bounds.width, bounds.height); this.setBounds(20, 10, bounds.width, bounds.height);
} else { } else {
this.setBounds(10, 10, bounds.width, bounds.height); this.setBounds(10, 10, bounds.width, bounds.height);
} }
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
} }
private class CustomShapedDialog extends UIDialog { private class CustomShapedDialog extends UIDialog {
private static final int GAP_SMALL = 10; private static final int GAP_SMALL = 10;
private static final int GAP = 20; private static final int GAP = 20;
private static final int GAP_BIG = 30; private static final int GAP_BIG = 30;
public CustomShapedDialog(Frame parent) { public CustomShapedDialog(Frame parent) {
super(parent); super(parent);
this.initComponents(); this.initComponents();
} }
public CustomShapedDialog(Dialog parent) { public CustomShapedDialog(Dialog parent) {
super(parent); super(parent);
this.initComponents(); this.initComponents();
} }
private Shape getCustomShap() { private Shape getCustomShap() {
Polygon polygon = new Polygon(); Polygon polygon = new Polygon();
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
polygon.addPoint(GAP_SMALL, 0); polygon.addPoint(GAP_SMALL, 0);
polygon.addPoint(bounds.width + GAP_BIG, 0); polygon.addPoint(bounds.width + GAP_BIG, 0);
polygon.addPoint(bounds.width + GAP_BIG, bounds.height + GAP); polygon.addPoint(bounds.width + GAP_BIG, bounds.height + GAP);
polygon.addPoint(GAP_SMALL, bounds.height + GAP); polygon.addPoint(GAP_SMALL, bounds.height + GAP);
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(0, (int) ((bounds.height + GAP) * time - GAP)); polygon.addPoint(0, (int) ((bounds.height + GAP) * time - GAP));
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL, 0); polygon.addPoint(GAP_SMALL, 0);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP), 0); polygon.addPoint((int) (bounds.width * time + GAP), 0);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, GAP_SMALL); polygon.addPoint(bounds.width + GAP, GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG); polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG);
polygon.addPoint(0, bounds.height + GAP_BIG); polygon.addPoint(0, bounds.height + GAP_BIG);
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(0, 0); polygon.addPoint(0, 0);
polygon.addPoint(bounds.width + GAP, 0); polygon.addPoint(bounds.width + GAP, 0);
polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_BIG); polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_BIG);
polygon.addPoint(bounds.width + GAP_BIG, (int) ((bounds.height + GAP) * time) - GAP); polygon.addPoint(bounds.width + GAP_BIG, (int) ((bounds.height + GAP) * time) - GAP);
polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(bounds.width + GAP, bounds.height + GAP); polygon.addPoint(bounds.width + GAP, bounds.height + GAP);
polygon.addPoint(0, bounds.height + GAP); polygon.addPoint(0, bounds.height + GAP);
polygon.addPoint(0, 0); polygon.addPoint(0, 0);
} }
return polygon; return polygon;
} }
private Shape getShape4Board() { private Shape getShape4Board() {
Polygon polygon = new Polygon(); Polygon polygon = new Polygon();
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
polygon.addPoint(GAP_SMALL, 1); polygon.addPoint(GAP_SMALL, 1);
polygon.addPoint(bounds.width + GAP_BIG - 1, 1); polygon.addPoint(bounds.width + GAP_BIG - 1, 1);
polygon.addPoint(bounds.width + GAP_BIG - 1, bounds.height + GAP - 1); polygon.addPoint(bounds.width + GAP_BIG - 1, bounds.height + GAP - 1);
polygon.addPoint(GAP_SMALL + 1, bounds.height + GAP - 1); polygon.addPoint(GAP_SMALL + 1, bounds.height + GAP - 1);
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(1, (int) ((bounds.height + GAP) * time - GAP)); polygon.addPoint(1, (int) ((bounds.height + GAP) * time - GAP));
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL + 1, 1); polygon.addPoint(GAP_SMALL + 1, 1);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL + 1); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP), 1); polygon.addPoint((int) (bounds.width * time + GAP), 1);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL + 1); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL + 1); polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1); polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, bounds.height + GAP_BIG - 1); polygon.addPoint(1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
} else if(arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(1, 1); polygon.addPoint(1, 1);
polygon.addPoint(bounds.width + GAP - 1, 1); polygon.addPoint(bounds.width + GAP - 1, 1);
polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG); polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG);
polygon.addPoint(bounds.width + GAP_BIG - 1, (int) ((bounds.height + GAP) * time) - GAP); polygon.addPoint(bounds.width + GAP_BIG - 1, (int) ((bounds.height + GAP) * time) - GAP);
polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP - 1); polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP - 1);
polygon.addPoint(1, bounds.height + GAP - 1); polygon.addPoint(1, bounds.height + GAP - 1);
polygon.addPoint(1, 0); polygon.addPoint(1, 0);
} }
return polygon; return polygon;
} }
/** protected void initComponents() {
* 画出界面的样式, 边框等. setUndecorated(true);
*/ try {
public void paint(Graphics g) { AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap());
super.paint(g); } catch (UnsupportedOperationException e) {
Graphics2D g2d = (Graphics2D) g;
Stroke oldStroke = g2d.getStroke();
g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
g2d.setStroke(oldStroke);
}
protected void initComponents() {
setUndecorated(true);
try {
AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap());
} catch (UnsupportedOperationException e) {
FineLoggerFactory.getLogger().info("Not support"); FineLoggerFactory.getLogger().info("Not support");
} }
final JPanel contentPane = (JPanel) this.getContentPane(); final JPanel contentPane = (JPanel) this.getContentPane();
this.setLayout(null); this.setLayout(null);
contentPane.add(UIBubbleFloatPane.this); contentPane.add(UIBubbleFloatPane.this);
setVisible(true); contentPane.setBorder(new Border() {
} @Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
/** Graphics2D g2d = (Graphics2D) g;
* 检查 Stroke oldStroke = g2d.getStroke();
*/ g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
public void checkValid() throws Exception { g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
} g2d.setStroke(oldStroke);
} }
@Override
public Insets getBorderInsets(Component c) {
return null;
}
@Override
public boolean isBorderOpaque() {
return false;
}
});
}
/**
* 检查
*/
public void checkValid() throws Exception {
}
}
} }

7
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -23,7 +23,7 @@ import java.util.List;
* @editor zhou * @editor zhou
* @since 2012-3-28下午3:07:44 * @since 2012-3-28下午3:07:44
*/ */
public abstract class UITableModelAdapter<T extends Object> extends AbstractTableModel implements UITableEditorLoader { public abstract class UITableModelAdapter<T> extends AbstractTableModel implements UITableEditorLoader {
/** /**
* *
@ -37,7 +37,6 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
// list里放的是一行数据 // list里放的是一行数据
private List<T> list = new ArrayList<T>(); private List<T> list = new ArrayList<T>();
@SuppressWarnings({ "unchecked", "rawtypes" })
protected UITableModelAdapter(String[] columnNames) { protected UITableModelAdapter(String[] columnNames) {
this.columnNames = columnNames; this.columnNames = columnNames;
table = new JTable(this); table = new JTable(this);
@ -101,8 +100,8 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
} }
} }
public void setRowAt(T value, int rowIndwx) { public void setRowAt(T value, int rowIndex) {
this.list.set(rowIndwx, value); this.list.set(rowIndex, value);
} }
/** /**

61
designer-base/src/main/java/com/fr/design/utils/ParameterUtils.java

@ -0,0 +1,61 @@
package com.fr.design.utils;
import com.fr.base.Parameter;
import com.fr.base.ParameterHelper;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* @Author: Yuan.Wang
* @Date: 2020/8/11
*/
public class ParameterUtils {
/**
* 获得新的参数集合,返回的集合中的参数的顺序为新增参数全部放在后面以保证原有参数的相对顺序
*
* @param paramTexts sql语句
* @param oldParameters 旧的参数集合
* @return 新参数集合
*/
public static Parameter[] analyzeAndUnionParameters(String[] paramTexts, Parameter[] oldParameters) {
Parameter[] newParameters = ParameterHelper.analyze4Parameters(paramTexts, false);
return unionParametersInRelativeOrder(oldParameters, newParameters);
}
/**
* 合并新旧参数集合新增参数全部放在后面以保证原有参数的相对顺序
*
* @param oldParameters 旧的参数集合
* @param newParameters 新的参数集合
* @return 新参数集合
*/
private static Parameter[] unionParametersInRelativeOrder(Parameter[] oldParameters, Parameter[] newParameters) {
if (ArrayUtils.isEmpty(newParameters) || ArrayUtils.isEmpty(oldParameters)) {
return newParameters;
}
Parameter[] result = new Parameter[newParameters.length];
List<Parameter> newParameterList = new ArrayList<>(Arrays.asList(newParameters));
int i = 0;
//遍历旧参数数组中的参数,如果新参数list中存在同名参数,将该参数加入到result里,同时删除list中的同名参数
for (Parameter oldParameter : oldParameters) {
Iterator<Parameter> iterator = newParameterList.listIterator();
while (iterator.hasNext()) {
Parameter newParameter = iterator.next();
if (ComparatorUtils.equals(oldParameter.getName(), newParameter.getName())) {
result[i++] = oldParameter;
iterator.remove();
break;
}
}
}
//将新参数list中的剩余参数添加到result中
System.arraycopy(newParameterList.toArray(new Parameter[0]), 0, result, i, newParameterList.size());
return result;
}
}

38
designer-base/src/test/java/com/fr/design/utils/ParameterUtilsTest.java

@ -0,0 +1,38 @@
package com.fr.design.utils;
import com.fr.base.Parameter;
import junit.framework.TestCase;
/**
* @Author: Yuan.Wang
* @Date: 2020/8/11
*/
public class ParameterUtilsTest extends TestCase {
public void testAnalyzeAndUnionParameters() {
String[] paramTexts = {"${a}${b}${d}", ""};
Parameter[] oldParameters = new Parameter[]{new Parameter("c"), new Parameter("b"), new Parameter("a")};
Parameter[] rightResult = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")};
Parameter[] result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length, rightResult.length);
for (int i = 0; i < rightResult.length; i++) {
assertEquals(rightResult[i].getName(), result[i].getName());
}
paramTexts = new String[]{"${a}${b}${d}", ""};
oldParameters = new Parameter[]{};
rightResult = new Parameter[]{new Parameter("a"), new Parameter("b"), new Parameter("d")};
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length,rightResult.length);
paramTexts = new String[]{"${b}", ""};
oldParameters = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")};
rightResult = new Parameter[]{new Parameter("b")};
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length,rightResult.length);
assertEquals(result.length, rightResult.length);
for (int i = 0; i < rightResult.length; i++) {
assertEquals(rightResult[i].getName(), result[i].getName());
}
}
}

89
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -1,7 +1,6 @@
package com.fr.van.chart.designer.style; package com.fr.van.chart.designer.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.UIBubbleFloatPane;
@ -61,6 +60,7 @@ public class VanChartPlotLegendPane extends BasicPane {
private UIButtonGroup<LayoutType> layoutButton; private UIButtonGroup<LayoutType> layoutButton;
private JPanel layoutPane; private JPanel layoutPane;
private VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
private UIBubbleFloatPane uiBubbleFloatPane;
//区域显示策略 恢复用注释。下面4行删除。 //区域显示策略 恢复用注释。下面4行删除。
private UIButtonGroup<Integer> customSize; private UIButtonGroup<Integer> customSize;
@ -80,7 +80,7 @@ public class VanChartPlotLegendPane extends BasicPane {
initComponents(); initComponents();
} }
public VanChartPlotLegendPane(VanChartStylePane parent){ public VanChartPlotLegendPane(VanChartStylePane parent) {
this.parent = parent; this.parent = parent;
initComponents(); initComponents();
} }
@ -118,9 +118,9 @@ public class VanChartPlotLegendPane extends BasicPane {
new Component[]{legendPane}, new Component[]{legendPane},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,row,col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
addLegendListener(); addLegendListener();
} }
@ -133,7 +133,7 @@ public class VanChartPlotLegendPane extends BasicPane {
}); });
} }
protected JPanel createLegendPaneWithoutHighlight(){ protected JPanel createLegendPaneWithoutHighlight() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = new VanChartBackgroundWithOutImagePane();
@ -141,19 +141,19 @@ public class VanChartPlotLegendPane extends BasicPane {
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,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()), null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createLegendPane(){ protected JPanel createLegendPane() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = new VanChartBackgroundWithOutImagePane();
highlightPane = createHighlightPane(); highlightPane = createHighlightPane();
@ -166,14 +166,14 @@ public class VanChartPlotLegendPane extends BasicPane {
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,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel), null},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
@ -205,12 +205,12 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), location},
new Component[]{null,customFloatPositionButton} new Component[]{null, customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
layoutPane = createLayoutPane(); layoutPane = createLayoutPane();
initPositionListener(); initPositionListener();
@ -241,7 +241,7 @@ public class VanChartPlotLegendPane extends BasicPane {
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private void initPositionListener(){ private void initPositionListener() {
location.addChangeListener(new ChangeListener() { location.addChangeListener(new ChangeListener() {
@Override @Override
@ -262,18 +262,20 @@ public class VanChartPlotLegendPane extends BasicPane {
checkLayoutPaneVisible(); checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
if(customFloatPositionPane == null) { if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
}
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
} }
Point comPoint = customFloatPositionButton.getLocationOnScreen(); uiBubbleFloatPane.show(VanChartPlotLegendPane.this, null);
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth()/2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
UIBubbleFloatPane<Style> pane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
pane.show(VanChartPlotLegendPane.this, null);
} }
}); });
} }
@ -309,19 +311,19 @@ public class VanChartPlotLegendPane extends BasicPane {
// return limitPane; // return limitPane;
} }
private JPanel createHighlightPane(){ private JPanel createHighlightPane() {
highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")); highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight"));
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[]{null,null}, new Component[]{null, null},
new Component[]{highlightLabel, highlightButton} new Component[]{highlightLabel, highlightButton}
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
} }
protected void checkAllUse() { protected void checkAllUse() {
@ -368,6 +370,7 @@ public class VanChartPlotLegendPane extends BasicPane {
/** /**
* 标题 * 标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -375,7 +378,7 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
public void updateBean(VanChartLegend legend) { public void updateBean(VanChartLegend legend) {
if(legend == null) { if (legend == null) {
legend = new VanChartLegend(); legend = new VanChartLegend();
} }
legend.setLegendVisible(isLegendVisible.isSelected()); legend.setLegendVisible(isLegendVisible.isSelected());
@ -383,7 +386,7 @@ public class VanChartPlotLegendPane extends BasicPane {
borderPane.update(legend); borderPane.update(legend);
backgroundPane.update(legend); backgroundPane.update(legend);
if(!customFloatPositionButton.isSelected()){ if (!customFloatPositionButton.isSelected()) {
legend.setPosition(location.getSelectedItem()); legend.setPosition(location.getSelectedItem());
} else { } else {
legend.setPosition(-1); legend.setPosition(-1);
@ -397,7 +400,7 @@ public class VanChartPlotLegendPane extends BasicPane {
//legend.setLimitAttribute(limitPane.updateBean()); //legend.setLimitAttribute(limitPane.updateBean());
legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
if(highlightButton != null && highlightButton.getSelectedItem() != null){ if (highlightButton != null && highlightButton.getSelectedItem() != null) {
legend.setHighlight(highlightButton.getSelectedItem()); legend.setHighlight(highlightButton.getSelectedItem());
} }
} }
@ -408,7 +411,7 @@ public class VanChartPlotLegendPane extends BasicPane {
textAttrPane.populate(legend.getFRFont()); textAttrPane.populate(legend.getFRFont());
borderPane.populate(legend); borderPane.populate(legend);
backgroundPane.populate(legend); backgroundPane.populate(legend);
if(!legend.isFloating()){ if (!legend.isFloating()) {
location.setSelectedItem(legend.getPosition()); location.setSelectedItem(legend.getPosition());
} }
customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionButton.setSelected(legend.isFloating());
@ -420,7 +423,7 @@ public class VanChartPlotLegendPane extends BasicPane {
maxProportion.setValue(legend.getMaxHeight()); maxProportion.setValue(legend.getMaxHeight());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//limitPane.populateBean(legend.getLimitAttribute()); //limitPane.populateBean(legend.getLimitAttribute());
if(highlightButton != null){ if (highlightButton != null) {
highlightButton.setSelectedItem(legend.isHighlight()); highlightButton.setSelectedItem(legend.isHighlight());
boolean largeDataModel = PlotFactory.largeDataModel(plot); boolean largeDataModel = PlotFactory.largeDataModel(plot);
highlightButton.setEnabled(!largeDataModel); highlightButton.setEnabled(!largeDataModel);

75
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -2,7 +2,6 @@ package com.fr.van.chart.designer.style;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chartx.config.info.constant.ConfigType; import com.fr.chartx.config.info.constant.ConfigType;
@ -61,6 +60,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private UIToggleButton useHtml; private UIToggleButton useHtml;
private UIToggleButton customFloatPositionButton; private UIToggleButton customFloatPositionButton;
private VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
private UIBubbleFloatPane uiBubbleFloatPane;
//区域显示策略 恢复用注释。下面3行删除。 //区域显示策略 恢复用注释。下面3行删除。
private UIButtonGroup<Integer> limitSize; private UIButtonGroup<Integer> limitSize;
@ -101,7 +101,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
isTitleVisible.addActionListener(new ActionListener() { isTitleVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -111,7 +111,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
} }
private JPanel createTitlePane(){ private JPanel createTitlePane() {
backgroundPane = new VanChartBackgroundWithOutShadowWithRadiusPane(); backgroundPane = new VanChartBackgroundWithOutShadowWithRadiusPane();
@ -120,32 +120,32 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] column = {f, e}; double[] column = {f, e};
double[] rowSize = {p,p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitleContentPane(new double[]{p,p,p},column),null}, new Component[]{createTitleContentPane(new double[]{p, p, p}, column), null},
new Component[]{createTitlePositionPane(new double[]{p,p,p},column),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, column), null},
new Component[]{createTitleStylePane(),null}, new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{createDisplayStrategy(),null} new Component[]{createDisplayStrategy(), null}
}; };
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private JPanel createTitleContentPane(double[] row, double[] col){ private JPanel createTitleContentPane(double[] row, double[] col) {
titleContent = new TinyFormulaPane(); titleContent = new TinyFormulaPane();
useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html"));
UIComponentUtils.setLineWrap(useHtml); UIComponentUtils.setLineWrap(useHtml);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null ,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent},
new Component[]{null ,useHtml}, new Component[]{null, useHtml},
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), panel);
} }
private JPanel createTitlePositionPane(double[] row, double[] col){ private JPanel createTitlePositionPane(double[] row, double[] col) {
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
@ -157,25 +157,25 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT),alignmentPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT), alignmentPane},
new Component[]{null,customFloatPositionButton} new Component[]{null, customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
initPositionListener(); initPositionListener();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel);
} }
private JPanel createTitleStylePane(){ private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }
private JPanel createDisplayStrategy(){ private JPanel createDisplayStrategy() {
//区域显示策略 恢复用注释。开始删除。 //区域显示策略 恢复用注释。开始删除。
maxProportion = new UISpinner(0, 100, 1, 30); maxProportion = new UISpinner(0, 100, 1, 30);
limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")});
@ -203,7 +203,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
// return limitPane; // return limitPane;
} }
private void initPositionListener(){ private void initPositionListener() {
alignmentPane.addChangeListener(new ChangeListener() { alignmentPane.addChangeListener(new ChangeListener() {
@Override @Override
@ -225,15 +225,17 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (customFloatPositionPane == null) { if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
} }
Point comPoint = customFloatPositionButton.getLocationOnScreen(); if (uiBubbleFloatPane == null) {
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); Point comPoint = customFloatPositionButton.getLocationOnScreen();
UIBubbleFloatPane<Style> pane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
@Override uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
public void updateContentPane() { @Override
parent.attributeChanged(); public void updateContentPane() {
} parent.attributeChanged();
}; }
pane.show(VanChartTitlePane.this, null); };
}
uiBubbleFloatPane.show(VanChartTitlePane.this, null);
} }
}); });
} }
@ -270,6 +272,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
/** /**
* 弹出框的界面标题 * 弹出框的界面标题
*
* @return 界面标题 * @return 界面标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -283,7 +286,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
@Override @Override
public void populateBean(VanChart chart) { public void populateBean(VanChart chart) {
VanChartTitle title = (VanChartTitle)chart.getTitle(); VanChartTitle title = (VanChartTitle) chart.getTitle();
if (title == null) { if (title == null) {
return; return;
} }
@ -293,7 +296,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} else { } else {
titleContent.populateBean(Utils.objectToString(title.getTextObject())); titleContent.populateBean(Utils.objectToString(title.getTextObject()));
} }
if(!title.isFloating()){ if (!title.isFloating()) {
alignmentPane.setSelectedItem(title.getPosition()); alignmentPane.setSelectedItem(title.getPosition());
} else { } else {
alignmentPane.setSelectedIndex(-1); alignmentPane.setSelectedIndex(-1);
@ -323,7 +326,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (chart == null) { if (chart == null) {
chart = new VanChart(); chart = new VanChart();
} }
VanChartTitle title = (VanChartTitle)chart.getTitle(); VanChartTitle title = (VanChartTitle) chart.getTitle();
if (title == null) { if (title == null) {
title = new VanChartTitle(StringUtils.EMPTY); title = new VanChartTitle(StringUtils.EMPTY);
} }
@ -341,7 +344,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (textAttr == null) { if (textAttr == null) {
textAttr = new TextAttr(); textAttr = new TextAttr();
} }
if(!customFloatPositionButton.isSelected()){ if (!customFloatPositionButton.isSelected()) {
title.setPosition(alignmentPane.getSelectedItem()); title.setPosition(alignmentPane.getSelectedItem());
} }
title.setUseHtml(useHtml.isSelected()); title.setUseHtml(useHtml.isSelected());

5
designer-realize/src/main/java/com/fr/poly/PolyDesigner.java

@ -390,6 +390,11 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
setChooseType(SelectionType.NONE); setChooseType(SelectionType.NONE);
return; return;
} }
if (this.selection == null && this.selectedtype != SelectionType.NONE) {
this.selectedtype = SelectionType.NONE;
}
if (this.selection != selectElement) { if (this.selection != selectElement) {
this.selection = selectElement; this.selection = selectElement;
fireSelectionChanged(); fireSelectionChanged();

2
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -144,7 +144,7 @@ public class MainDesigner extends BaseDesigner {
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[0]);
} }
@Override @Override

Loading…
Cancel
Save