Browse Source

Merge branch 'feature/10.0' of https://code.fineres.com/scm/~hades/design into feature/10.0

feature/10.0
hades 3 years ago
parent
commit
e7bc409cc2
  1. 13
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/editor/editor/Editor.java
  3. 7
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java
  4. 5
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  5. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  6. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java
  7. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  8. 2
      designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java
  9. 14
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java
  10. 71
      designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java
  11. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

13
designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java

@ -42,6 +42,7 @@ public class DBCPAttrPane extends BasicPane {
private static final int ORACLE_DEFAULT_FETCHSIZE = 128;
private static final int DB2_DEFAULT_FETCHSIZE = 50;
private static final int POSTGRE_DEFAULT_FETCHSIZE = 10000;
private static final int EMPTY_FETCHSIZE = -2;
// carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();
private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor();
@ -125,7 +126,11 @@ public class DBCPAttrPane extends BasicPane {
this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis());
Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName());
if (fetchSize != null) {
this.FETCHSIZE.setText(jdbcDatabase.getFetchSize() == -1 ? String.valueOf(fetchSize) : String.valueOf(jdbcDatabase.getFetchSize()));
if (jdbcDatabase.getFetchSize() == EMPTY_FETCHSIZE) {
this.FETCHSIZE.setText(StringUtils.EMPTY);
} else {
this.FETCHSIZE.setText(jdbcDatabase.getFetchSize() == -1 ? String.valueOf(fetchSize) : String.valueOf(jdbcDatabase.getFetchSize()));
}
}
}
@ -149,7 +154,11 @@ public class DBCPAttrPane extends BasicPane {
dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue());
Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName());
if (fetchSize != null) {
jdbcDatabase.setFetchSize(Integer.parseInt(this.FETCHSIZE.getText()));
if (StringUtils.isEmpty(this.FETCHSIZE.getText())) {
jdbcDatabase.setFetchSize(EMPTY_FETCHSIZE);
} else {
jdbcDatabase.setFetchSize(Integer.parseInt(this.FETCHSIZE.getText()));
}
}
}

4
designer-base/src/main/java/com/fr/design/editor/editor/Editor.java

@ -4,6 +4,7 @@
package com.fr.design.editor.editor;
import com.fr.base.BaseUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -34,6 +35,9 @@ public abstract class Editor<T> extends JComponent {
// 约定图片的文件名为this.getName(),处理起来方便些
// b:这里国际化没有考虑
public Icon getIcon() {
if (StringUtils.isEmpty(this.getIconName())) {
return null;
}
String iconName = "com/fr/design/images/buttonicon/" + this.getIconName() + ".png";
try {
return BaseUtils.readIcon(iconName);

7
designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java

@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged();
}
});
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
@ -68,4 +68,9 @@ public class BackgroundSpecialPane extends BackgroundPane{
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
}
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() {
// 使用默认的150宽度构建渐变条
return new GradientBackgroundQuickPane();
}
}

5
designer-base/src/main/java/com/fr/env/CheckServiceDialog.java vendored

@ -167,7 +167,8 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
centerPanel.add(detailsPane, BorderLayout.CENTER);
JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_M_Pane();
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
if (isOnline()) {
boolean Sync = false;
if (isOnline() && Sync) {
ignoreButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_Ignore"));
ignoreButton.addActionListener(this);
syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local"));
@ -183,8 +184,6 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
buttonPanel.add(progressBar, BorderLayout.CENTER);
buttonPanel.add(syncButton, BorderLayout.EAST);
} else {
UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion"));
centerPanel.add(adviceLabel, BorderLayout.SOUTH);
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm"));
okButton.addActionListener(this);
buttonPanel.add(okButton, BorderLayout.EAST);

2
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -423,7 +423,7 @@ public class PlotFactory {
//大数据模式 恢复用注释。删除下面2个方法 largeDataModel lineMapLargeModel。
public static boolean largeDataModel(Plot plot) {
return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK;
return plot != null && plot.isLargeDataModel();
}
public static boolean lineMapLargeModel(Plot plot) {

9
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -293,7 +293,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString));
timeAxis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString));
timeAxis.setMinValue(createDataFormula(dateString));
}
} else {
timeAxis.setCustomMinValue(false);
@ -308,7 +308,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString));
timeAxis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString));
timeAxis.setMaxValue(createDataFormula(dateString));
}
} else {
timeAxis.setCustomMaxValue(false);
@ -332,6 +332,11 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
checkBoxUse();
}
private BaseFormula createDataFormula(String dateString) {
String formulaString = "\"" + dateString + "\"";
return BaseFormula.createFormulaBuilder().build(formulaString);
}
public void populate(VanChartTimeAxis timeAxis){
// 最小值
if (timeAxis.isCustomMinValue() && timeAxis.getMinValue() != null) {

4
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -203,6 +203,10 @@ public class XWAbsoluteLayout extends XLayoutContainer {
double percentH = ((double) backupBound.height / (double) currentBound.height);
for (int index = 0, n = this.getComponentCount(); index < n; index++) {
XCreator creator = (XCreator) this.getComponent(index);
if (creator.toData().isAspectRatioLocked()) {
double percent = Math.min(percentW, percentH);
percentW = percentH = percent;
}
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
// 用当前的显示大小计算后调正具体位置
Rectangle wgtBound = creator.getBounds();

2
designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

@ -62,7 +62,7 @@ import java.net.URISyntaxException;
* 可配置图片类型边框的样式设置面板
*/
public class BorderLineAndImagePane extends JPanel implements UIObserver {
private final int SETTING_LABEL_WIDTH = 60;
private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH;
private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT);
private final String TWEAK_NINE_POINT_HELP_URL = "";

14
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

@ -24,6 +24,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
import com.fr.general.Background;
@ -51,7 +52,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow")
};
private static final Dimension BUTTON_SIZE = new Dimension(20, 20);
private static final int SETTING_LABEL_WIDTH = 60;
public static final int SETTING_LABEL_WIDTH = 60;
protected LayoutBorderStyle style = new LayoutBorderStyle();
@ -124,7 +125,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
borderStyleCombo = new UIComboBox(BORDER_STYLE);
borderLineAndImagePane = new BorderLineAndImagePane();
cornerSpinner = new UISpinner(0,1000,1,0);
backgroundPane = new BackgroundSpecialPane();
backgroundPane = new LayoutBackgroundSpecialPane();
backgroundOpacityPane = new UIPercentDragPane();
}
@ -229,7 +230,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")
});
titleBackgroundPane = new BackgroundSpecialPane();
titleBackgroundPane = new LayoutBackgroundSpecialPane();
titleBackgroundOpacityPane = new UIPercentDragPane();
}
@ -499,4 +500,11 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
g2d.setColor(oldColor);
}
}
protected static class LayoutBackgroundSpecialPane extends BackgroundSpecialPane {
@Override
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() {
return new GradientBackgroundQuickPane(140);
}
}
}

71
designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java

@ -33,6 +33,10 @@ import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D;
/**
* @author Starryi
@ -40,7 +44,7 @@ import java.awt.event.ActionListener;
* Created by Starryi on 2021/7/3
*/
public class TitleInsetImagePane extends JPanel implements UIObserver {
private final int SETTING_LABEL_WIDTH = 60;
private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH;
private final int DELETE_BUTTON_SIZE = 24;
private final int IMAGE_PREVIEW_SIZE = 145;
private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT);
@ -89,6 +93,28 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
deletableImagePreviewPane.add(imageDeleteButton, 0);
deletableImagePreviewPane.add(imagePreviewPane, 1);
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
deletableImagePreviewPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
super.mouseEntered(e);
imageDeleteButton.setVisible(true);
imageDeleteButton.setEnabled(true);
}
@Override
public void mouseExited(MouseEvent e) {
super.mouseExited(e);
int x = e.getX();
int y = e.getY();
if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) {
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
}
}
});
return TableLayoutHelper.createCommonTableLayoutPane(
new JComponent[][]{
{null, deletableImagePreviewPane},
@ -110,15 +136,11 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
private void initComponents() {
imageChooseButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_choose_inset.png"));
imageDeleteButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"));
imageDeleteButton.setUI(new BasicButtonUI());
imageDeleteButton.setOpaque(true);
imageDeleteButton.setBorderPainted(false);
imageDeleteButton.setBorder(null);
imageDeleteButton.setFocusPainted(false);
imageDeleteButton.setContentAreaFilled(true);
imageDeleteButton = new OpaqueColorButton(
IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"),
new Color(51, 51, 52, 178),
2);
imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE));
imageDeleteButton.setBackground(new Color(51, 51, 51));
imagePreviewPane = new ImagePreviewPane();
imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE);
@ -255,4 +277,35 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
public boolean shouldResponseChangeListener() {
return true;
}
private static class OpaqueColorButton extends UIButton {
private final Color color;
private final int radius;
public OpaqueColorButton(Icon icon, Color color, int radius) {
super(icon);
setUI(new BasicButtonUI());
setOpaque(true);
setBorderPainted(false);
setBorder(null);
setFocusPainted(false);
setContentAreaFilled(false);
this.color = color;
this.radius = radius;
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor();
Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), radius, radius);
g2d.clip(shape);
g2d.setColor(color);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setColor(oldColor);
super.paint(g);
}
}
}

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -104,6 +104,10 @@ public class WidgetBoundPane extends BasicPane {
public void populate() {
Rectangle bounds = new Rectangle(creator.getBounds());
if (ratioLockedButton != null) {
// 临时禁止尺寸比例锁定,关掉widthSpinner/heightSpinner之间的数值关联,以更新其高度和宽度值
ratioLockedButton.setLocked(false);
}
width.setValue(bounds.width);
height.setValue(bounds.height);
if (ratioLockedButton != null) {

Loading…
Cancel
Save