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 65652cbcd5..757bbbbe08 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 4863a27960..dc37d14bea 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 956df9efba..ce3a2f9da6 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 43b7b9614d..9928d9ae0e 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 968f72a599..1c30d35bc3 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); } 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 0a04eabf55..1515477a3d 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 59e5e8825e..37b1e74e4a 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 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 6b6408d937..b302ec8632 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); 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 7c3a1e7a6e..9fb0ec2b9f 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 @@ -17,7 +17,7 @@ public class DesignerStartup extends Activator { @Metrics public void start() { startSub(PreStartActivator.class); - getSub("parallel").start(); + startSub("parallel"); //designer模块启动好后,查看demo browserDemo(); startSub(StartFinishActivator.class); @@ -26,7 +26,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 ab4448434c..e1caf7ce95 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 @@ -34,7 +34,7 @@ public class DesignerWorkspaceActivator extends Activator { @Override public void on(Event event, Workspace current) { - getSub(EnvBasedModule.class).stop(); + stopSub(EnvBasedModule.class); } }); /*切换环境后,重新启动所有相关模块,最先执行*/ @@ -43,7 +43,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 e1779c3e24..9bf9357405 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 630f96b20e..2f565bb084 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()) {