Browse Source

REPORT-21689 水印密度最小值限制,根据交互提供的内容补充

research/11.0
Hugh.C 5 years ago
parent
commit
d7b8ba9f39
  1. 11
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  2. 13
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

11
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -39,6 +39,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private String spinnerName = StringUtils.EMPTY; private String spinnerName = StringUtils.EMPTY;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private boolean lessMinValue = false;
public UISpinner(double minValue, double maxValue, double dierta) { public UISpinner(double minValue, double maxValue, double dierta) {
@ -97,6 +98,10 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
return nextButton; return nextButton;
} }
public boolean isLessMinValue() {
return lessMinValue;
}
public void setValue(double value) { public void setValue(double value) {
setValue(value, true); setValue(value, true);
} }
@ -113,7 +118,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
if (globalNameListener != null && shouldResponseNameListener()) { if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName); globalNameListener.setGlobalName(spinnerName);
} }
value = value < minValue ? minValue : value; lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value; value = value > maxValue ? maxValue : value;
if (CommonUtils.equals(value, this.value)) { if (CommonUtils.equals(value, this.value)) {
return; return;
@ -135,7 +141,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
if (globalNameListener != null && shouldResponseNameListener()) { if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName); globalNameListener.setGlobalName(spinnerName);
} }
value = value < minValue ? minValue : value; lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value; value = value > maxValue ? maxValue : value;
if (CommonUtils.equals(value, this.value)) { if (CommonUtils.equals(value, this.value)) {

13
designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

@ -36,6 +36,7 @@ import java.awt.event.ItemListener;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.FocusAdapter;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -269,14 +270,10 @@ public class WatermarkPane extends BasicPane {
* @return * @return
*/ */
private FocusListener createFocusListener4GapNumberField(final UISpinner spinner, final int limitMinValue, final String messageStr) { private FocusListener createFocusListener4GapNumberField(final UISpinner spinner, final int limitMinValue, final String messageStr) {
return new FocusListener() { return new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
}
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (spinner.getValue() >= limitMinValue) { if (!spinner.isLessMinValue()) {
return; return;
} }
createGapDialog(new StringBuilder(messageStr).append(limitMinValue).toString()); createGapDialog(new StringBuilder(messageStr).append(limitMinValue).toString());
@ -294,8 +291,8 @@ public class WatermarkPane extends BasicPane {
private MouseListener createMouseListener4GapNextButton(final UISpinner spinner, final int limitMinValue, final String messageStr) { private MouseListener createMouseListener4GapNextButton(final UISpinner spinner, final int limitMinValue, final String messageStr) {
MouseAdapter mouseAdapter = new MouseAdapter() { MouseAdapter mouseAdapter = new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (spinner.getValue() >= limitMinValue) { if (!spinner.isLessMinValue()) {
return; return;
} }
createGapDialog(new StringBuilder(messageStr).append(limitMinValue).toString()); createGapDialog(new StringBuilder(messageStr).append(limitMinValue).toString());

Loading…
Cancel
Save