From 4f6f05beccafcadf7b6128c8e168440c3ab7dbdf Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 12 Sep 2019 15:18:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-21800=20=E6=B0=B4=E5=8D=B0=E5=AF=86?= =?UTF-8?q?=E5=BA=A6=E6=A1=86=E6=9C=80=E5=B0=8F=E9=99=90=E5=88=B6=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E5=88=A0=E6=8E=89=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E7=9A=84=E8=AF=9D=EF=BC=8C=E5=B0=B1=E6=98=AF?= =?UTF-8?q?=E5=B0=8F=E4=BA=8E100=EF=BC=8C=E6=97=A0=E6=B3=95=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/ispinner/UnsignedIntUISpinner.java | 43 ++++++++++++++++++- .../gui/itextfield/UIIntNumberField.java | 26 ++++++++--- 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java index 0a04eabf5..1515477a3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java @@ -3,6 +3,9 @@ package com.fr.design.gui.ispinner; import com.fr.design.gui.itextfield.UIIntNumberField; import com.fr.design.gui.itextfield.UINumberField; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + /** * Created by IntelliJ IDEA. * Author : Hugh.C @@ -11,21 +14,59 @@ import com.fr.design.gui.itextfield.UINumberField; */ public class UnsignedIntUISpinner extends UISpinner { + private double minValue; + private double maxValue; public UnsignedIntUISpinner(double minValue, double maxValue, double dierta) { super(minValue, maxValue, dierta); + this.minValue = minValue; + this.maxValue = maxValue; } public UnsignedIntUISpinner(double minValue, double maxValue, double dierta, double defaultValue) { super(minValue, maxValue, dierta, defaultValue); + this.minValue = minValue; + this.maxValue = maxValue; } @Override protected UINumberField initNumberField() { - return new UIIntNumberField() { + final UIIntNumberField numberField = new UIIntNumberField() { public boolean shouldResponseChangeListener() { return false; } + + public NumberDocument createNumberDocument() { + return new NumberDocument() { + public boolean isContinueInsertWhenOverMaxOrMinValue() { + return true; + } + }; + } }; + numberField.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + + } + + /** + * 失去焦点后再做范围限制、不然最小值为 100 时,输个 1 都不让.... + * @param e + */ + @Override + public void focusLost(FocusEvent e) { + double value = numberField.getValue(); + if (!isOverMaxOrMinValue(value)) { + return; + } + numberField.setValue(value < minValue ? minValue : maxValue); + } + + private boolean isOverMaxOrMinValue(double value) { + return value < minValue || value > maxValue; + } + }); + return numberField; } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java index 59e5e8825..37b1e74e4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java @@ -1,11 +1,10 @@ package com.fr.design.gui.itextfield; -import com.fr.design.gui.itextfield.UINumberField; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; -import java.awt.*; +import java.awt.Toolkit; /** * Created with IntelliJ IDEA. @@ -15,11 +14,11 @@ import java.awt.*; * To change this template use File | Settings | File Templates. */ public class UIIntNumberField extends UINumberField { - public void setFieldDocument(){ - setDocument(new NumberDocument()); + public void setFieldDocument() { + setDocument(createNumberDocument()); } - class NumberDocument extends PlainDocument { + public class NumberDocument extends PlainDocument { public NumberDocument() { } @@ -33,17 +32,30 @@ public class UIIntNumberField extends UINumberField { String strNew = str.substring(0, offset) + s + str.substring(offset, getLength()); - if (isOverMaxOrMinValue(strNew)) { + if (isOverMaxOrMinValue(strNew) && !isContinueInsertWhenOverMaxOrMinValue()) { Toolkit.getDefaultToolkit().beep(); return; } - setisContentChanged(true); + setisContentChanged(true); super.insertString(offset, s, a); } + /** + * 是否继续插入输入的字符 - 当超出范围时 + * + * @return true : 继续插入输入的字符 + */ + public boolean isContinueInsertWhenOverMaxOrMinValue() { + return false; + } + private boolean isOverMaxOrMinValue( String strNew) { return (Double.parseDouble(strNew)getMaxValue()); } } + + public NumberDocument createNumberDocument() { + return new NumberDocument(); + } } \ No newline at end of file From 7362c8186f39bc93804a95af50adf427db1210a5 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 16 Sep 2019 09:13:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-20327=20sonar=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/border/UIRoundedBorder.java | 15 ++++---- .../tabledatapane/MaxMemRowCountPanel.java | 7 ++-- .../com/fr/design/dialog/JWizardPanel.java | 36 +++++++++---------- .../com/fr/design/extra/QQLoginWebPane.java | 2 +- .../fr/design/file/MutilTempalteTabPane.java | 2 +- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java b/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java index 65652cbcd..757bbbbe0 100644 --- a/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java +++ b/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java @@ -13,23 +13,23 @@ import java.awt.geom.RoundRectangle2D; public class UIRoundedBorder extends LineBorder { private static final long serialVersionUID = 1L; - + private int roundedCorner; private int lineStyle; - + public UIRoundedBorder(Color color) { super(color); } - + public UIRoundedBorder(Color color, int thickness){ super(color, thickness); } - + public UIRoundedBorder(Color color, int thickness, int roundedCorners){ super(color, thickness, true); this.roundedCorner = roundedCorners; } - + public UIRoundedBorder(int lineStyle, Color color, int roundedCorners){ super(color, GraphHelper.getLineStyleSize(lineStyle), true); this.lineStyle = lineStyle; @@ -44,14 +44,15 @@ public class UIRoundedBorder extends LineBorder { return lineStyle; } + @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){ Color oldColor = g.getColor(); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(lineColor); - GraphHelper.draw(g2d, new RoundRectangle2D.Double(x, y, width - 1, height-1, roundedCorner, roundedCorner),lineStyle); + GraphHelper.draw(g2d, new RoundRectangle2D.Double(x, y, width - 1.0D, height - 1.0D, roundedCorner, roundedCorner), lineStyle); g2d.setColor(oldColor); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java index 4863a2796..dc37d14be 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java @@ -40,7 +40,8 @@ public class MaxMemRowCountPanel extends UIToolbar { } } }; - + + @Override public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); dim.width = 340; @@ -81,7 +82,7 @@ public class MaxMemRowCountPanel extends UIToolbar { public void setValue(int value) { if (value >= 0) { showMaxPanel(); - numberSpinner.setValue(Integer.valueOf(value)); + numberSpinner.setValue(value); } else { showAllPanel(); } @@ -94,4 +95,4 @@ public class MaxMemRowCountPanel extends UIToolbar { return ((Number) numberSpinner.getValue()).intValue(); } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java index 956df9efb..ce3a2f9da 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java +++ b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java @@ -48,7 +48,7 @@ public class JWizardPanel extends BasicPane { // Set the layout for the content area contentPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - + contentPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 4, 4)); // Step title @@ -60,16 +60,16 @@ public class JWizardPanel extends BasicPane { add(titlePanel, BorderLayout.NORTH); add(contentPane, BorderLayout.CENTER); } - + @Override protected String title4PopupWindow() { return "wizard"; } - + /** * Set the title to use for this step. Normally this title would be unique * for each wizards step. - * + * * @param stepTitle The title to use for this step. */ public void setStepTitle(String stepTitle) { @@ -82,7 +82,7 @@ public class JWizardPanel extends BasicPane { /** * Get the step title to use for this step. - * + * * @return The step title to use for this step. */ public String getStepTitle() { @@ -93,7 +93,7 @@ public class JWizardPanel extends BasicPane { * Get a JPanel to use for adding your own components to this WizardPanel. * Do not add components directly to the JWizardPanel. The JPanel uses the * layout given in the JWizardPanel constructor. - * + * * @return The JPanel to use for adding components for this wizard step. */ public JPanel getContentPane() { @@ -102,7 +102,7 @@ public class JWizardPanel extends BasicPane { /** * Get the wizard step to go to when the Back button is pressed. - * + * * @return The wizard step to go to when the Back button is pressed. */ @@ -114,7 +114,7 @@ public class JWizardPanel extends BasicPane { * Set the wizard step to go to when the Back button is pressed. This should * be set in the constructor of the JWizardPanel subclass since it * determines whether the Back button is enabled or not. - * + * * @param backStep * The wizard step to go to when the Back button is pressed. */ @@ -129,7 +129,7 @@ public class JWizardPanel extends BasicPane { /** * Get the wizard step to go to when the Next button is pressed. - * + * * @return The wizard step to go to when the Next button is pressed. */ public int getNextStep() { @@ -140,7 +140,7 @@ public class JWizardPanel extends BasicPane { * Set the wizard step to go to when the Next button is pressed. This should * be set in the constructor of the JWizardPanel subclass since it * determines whether the Next and Finish buttons are enabled or not. - * + * * @param nextStep The wizard step to go to when the Next button is pressed. */ public void setNextStep(int nextStep) { @@ -154,7 +154,7 @@ public class JWizardPanel extends BasicPane { /** * Returns the JWizardDialog in which this JWizardPanel resides. This is * valid only after the panel has been added to the dialog. - * + * * @return The JWizardDialog in which this JWizardPanel resides. */ @@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane { public void addNotify() { if (firstNotify) { Font font = stepTitleLabel.getFont(); - font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10); + font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10.0F); stepTitleLabel.setFont(font); firstNotify = false; } @@ -177,7 +177,7 @@ public class JWizardPanel extends BasicPane { /** * Set the JWizardDialog parent for this JWizardPanel. - * + * * @param dialogParent * The JWizardPanel parent for this JWizardPanel. */ @@ -188,7 +188,7 @@ public class JWizardPanel extends BasicPane { /** * Calls back(). This allows the JWizardDialog to call the protected method * back(). - * + * * @see #back() */ @@ -199,7 +199,7 @@ public class JWizardPanel extends BasicPane { /** * Calls next(). This allows the JWizardDialog to call the protected method * next(). - * + * * @see #next() */ void doNext() { @@ -209,7 +209,7 @@ public class JWizardPanel extends BasicPane { /** * Called when the Back button is pressed. By default this displays the * wizard step set by setBackStep(). - * + * * @see #setBackStep(int) */ protected void back() { @@ -219,11 +219,11 @@ public class JWizardPanel extends BasicPane { /** * Called when the Next button is pressed. By default this displays the * wizard step set by setNextStep(). - * + * * @see #setNextStep(int) */ protected void next() { dialogParent.goTo(getNextStep()); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java index 43b7b9614..9928d9ae0 100644 --- a/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java @@ -163,7 +163,7 @@ public class QQLoginWebPane extends JFXPanel { final BooleanProperty confirmationResult = new SimpleBooleanProperty(); // initialize the confirmation dialog final Stage dialog = new Stage(StageStyle.UTILITY); - dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2 + DEFAULT_OFFEST); + dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2.0D + DEFAULT_OFFEST); dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST); dialog.setHeight(DEFAULT_CONFIRM_HEIGHT); dialog.setWidth(DEFAULT_CONFIRM_WIDTH); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 968f72a59..1c30d35bc 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -322,7 +322,7 @@ public class MutilTempalteTabPane extends JComponent { @Override public void paintComponent(Graphics g) { super.paintComponent(g); - double maxWidth = getWidth() - LIST_BUTTON_WIDTH; //最大宽度 + double maxWidth = getWidth() - LIST_BUTTON_WIDTH * 1.0D; //最大宽度 Graphics2D g2d = (Graphics2D) g; paintBackgroundAndLine(g2d, maxWidth); } From f4d1a3aa65a7137246444969a2790c02b568f041 Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 16 Sep 2019 12:05:05 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E6=89=93?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerStartup.java | 4 ++-- .../java/com/fr/start/module/DesignerWorkspaceActivator.java | 4 ++-- .../java/com/fr/start/module/DesignerWorkspaceProvider.java | 2 +- .../src/main/java/com/fr/start/module/PreStartActivator.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index b1ad72251..60c899daa 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -18,7 +18,7 @@ public class DesignerStartup extends Activator { public void start() { startSub(PreStartActivator.class); - getSub("parallel").start(); + startSub("parallel"); //designer模块启动好后,查看demo browserDemo(); startSub(DesignerShowActivator.class); @@ -28,7 +28,7 @@ public class DesignerStartup extends Activator { private void browserDemo() { - if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) { + if (findSingleton(StartupArgs.class) != null && findSingleton(StartupArgs.class).isDemo()) { ServerStarter.browserDemoURL(); } } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java index e652cda6f..5ed52a9d0 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java @@ -36,7 +36,7 @@ public class DesignerWorkspaceActivator extends Activator { @Override public void on(Event event, Workspace current) { - getSub(EnvBasedModule.class).stop(); + stopSub(EnvBasedModule.class); } }); /*切换环境后,重新启动所有相关模块,最先执行*/ @@ -45,7 +45,7 @@ public class DesignerWorkspaceActivator extends Activator { @Override public void on(Event event, Workspace current) { - getSub(EnvBasedModule.class).start(); + startSub(EnvBasedModule.class); startServer(current); } }); diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index e1779c3e2..9bf935740 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -22,7 +22,7 @@ public class DesignerWorkspaceProvider extends Activator { //检查环境 DesignerEnvManager.checkNameEnvMap(); - if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) { + if (findSingleton(StartupArgs.class) != null && findSingleton(StartupArgs.class).isDemo()) { DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); } else { try { diff --git a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java index 630f96b20..2f565bb08 100644 --- a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java @@ -35,7 +35,7 @@ public class PreStartActivator extends Activator { BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); // 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了 - final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); + final String[] args = findSingleton(StartupArgs.class).get(); // 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件 checkDebugStart(); if (DesignUtils.isStarted()) { From b484ebe6a71ea1c548066dd3a180886b244a7ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 16 Sep 2019 17:50:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?CHART-10233=20=E9=83=A8=E5=88=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AE=9E=E7=8E=B0=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fields/AbstractCellDataFieldsPane.java | 25 +++++++++++++------ .../fields/AbstractDataSetFieldsPane.java | 7 +++--- ...ractCellDataFieldsWithSeriesValuePane.java | 17 ++++++++++--- ...tractDataSetFieldsWithSeriesValuePane.java | 19 +++++++++++--- .../design/chartx/impl/AbstractDataPane.java | 3 +-- .../mainframe/MiddleChartPropertyPane.java | 2 +- 6 files changed, 52 insertions(+), 21 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java index 6b6408d93..b302ec863 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java @@ -13,9 +13,9 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; +import java.util.Arrays; import java.awt.BorderLayout; import java.awt.Component; -import java.util.Arrays; /** * Created by shine on 2019/5/16. @@ -31,9 +31,21 @@ public abstract class AbstractCellDataFieldsPane ePane) { - addChartEditPane(collection.getSelectedChart().getPlot().getPlotID()); + addChartEditPane(collection.getSelectedChartProvider().getID()); setSupportCellData(true); this.container.setEPane(ePane); chartEditPane.populate(collection);