Browse Source

Merge pull request #1418 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit '8a2389228c79a3b683e5f5703725b80891bea724':
  REPORT-5484 表单控件位置组件改成焦点失去触发保存
master
superman 7 years ago
parent
commit
43d2c8a475
  1. 10
      designer_base/src/com/fr/design/gui/ispinner/UISpinner.java
  2. 1
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  3. 48
      designer_form/src/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java
  4. 17
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  5. 12
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

10
designer_base/src/com/fr/design/gui/ispinner/UISpinner.java

@ -101,11 +101,15 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
return;
}
this.value = value;
setTextField(value);
fireStateChanged();
}
protected void setTextField(double value){
textField.getDocument().removeDocumentListener(docListener);
textField.setValue(value);
textField.getDocument().addDocumentListener(docListener);
fireStateChanged();
}
public void setTextFieldValue(double value) {
@ -257,6 +261,10 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
}
}
});
initTextFiledListeners();
}
protected void initTextFiledListeners(){
textField.getDocument().removeDocumentListener(docListener);
textField.getDocument().addDocumentListener(docListener);
textField.addFocusListener(new FocusAdapter() {

1
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -215,6 +215,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public void updateWidgetBound (){
if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) {
widgetBoundPane.update();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_RESIZED);
}
designer.refreshDesignerUI();
}

48
designer_form/src/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java

@ -0,0 +1,48 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.gui.ispinner.UISpinner;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
/**
* Created by kerry on 2017/11/7.
*/
public class UIBoundSpinner extends UISpinner{
public UIBoundSpinner(double minValue, double maxValue, double dierta) {
super(minValue, maxValue, dierta);
}
public UIBoundSpinner(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue);
}
@Override
protected void initTextFiledListeners(){
this.getTextField().addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
setTextFieldValue(getTextField().getValue());
setTextField(value);
}
});
this.getTextField().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
setTextFieldValue(getTextField().getValue());
setTextField(value);
}
}
});
}
@Override
protected void setTextField(double value){
this.getTextField().setValue(value);
}
}

17
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -20,11 +20,12 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
super(source);
}
@Override
public void initBoundPane() {
x = new UISpinner(0, Integer.MAX_VALUE, 1);
y = new UISpinner(0, Integer.MAX_VALUE, 1);
width = new UISpinner(0, Integer.MAX_VALUE, 1);
height = new UISpinner(0, Integer.MAX_VALUE, 1);
x = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
y = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
x.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
y.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
@ -32,7 +33,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height));
}
@Override
public void update() {
super.update();
Rectangle bounds = new Rectangle(creator.getBounds());
@ -46,20 +47,22 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
creator.setBounds(bounds);
}
@Override
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec){
bounds.width = w;
}
@Override
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec){
bounds.height = h;
}
@Override
protected String title4PopupWindow() {
return "absoluteBound";
}
@Override
public void populate() {
super.populate();
Rectangle bounds = new Rectangle(creator.getBounds());

12
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -2,7 +2,11 @@ package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ispinner.UISpinner;
@ -48,8 +52,8 @@ public class WidgetBoundPane extends BasicPane {
}
public void initBoundPane() {
width = new UISpinner(0, Integer.MAX_VALUE, 1);
height = new UISpinner(0, Integer.MAX_VALUE, 1);
width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
if (creator.acceptType(XWCardLayout.class)) {
@ -64,6 +68,7 @@ public class WidgetBoundPane extends BasicPane {
fix();
}
@Override
protected String title4PopupWindow() {
return "widgetBound";
}
@ -86,7 +91,6 @@ public class WidgetBoundPane extends BasicPane {
if (bounds.height != h) {
limitHeight(wabs, h, bounds, rec);
}
creator.setBounds(bounds);
}

Loading…
Cancel
Save