Browse Source

Pull request #7032: REPORT-63106 决策报表-两个组件选中时拖拽到其他位置,然后点击对齐任意一个,两个组件会跳回刚才的位置

Merge in DESIGN/design from ~FANGLEI/design:release/10.0 to release/10.0

* commit 'a0798b48218e0f93de6a42859ff3504c4e22d5ce':
  REPORT-63106 决策报表-两个组件选中时拖拽到其他位置,然后点击对齐任意一个,两个组件会跳回刚才的位置
zheng-1641779399395
fanglei 3 years ago
parent
commit
861c84c4ae
  1. 33
      designer-form/src/main/java/com/fr/design/mainframe/ArrangementType.java
  2. 81
      designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java
  3. 14
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java
  4. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java
  5. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java
  6. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java
  7. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java
  8. 4
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java
  9. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java
  10. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java
  11. 13
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java
  12. 13
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java
  13. 5
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

33
designer-form/src/main/java/com/fr/design/mainframe/ArrangementType.java

@ -0,0 +1,33 @@
package com.fr.design.mainframe;
public enum ArrangementType {
LEFT_ALIGN(0),
RIGHT_ALIGN(1),
TOP_ALIGN(2),
BOTTOM_ALIGN(3),
HORIZONTAL_CENTER_ALIGN(4),
VERTICAL_CENTER_ALIGN(5),
HORIZONTAL_AUTO_DISTRIBUTION(6),
HORIZONTAL_MANUAL_DISTRIBUTION(7),
VERTICAL_AUTO_DISTRIBUTION(8),
VERTICAL_MANUAL_DISTRIBUTION(9);
private int type;
ArrangementType(int type) {
this.type = type;
}
public int getType() {
return this.type;
}
public static ArrangementType parse(int type) {
for (ArrangementType arrangementType : ArrangementType.values()) {
if (arrangementType.getType() == type) {
return arrangementType;
}
}
return LEFT_ALIGN;
}
}

81
designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java

@ -15,67 +15,103 @@ import java.util.Comparator;
import java.util.List; import java.util.List;
public class MultiSelectionArrangement { public class MultiSelectionArrangement {
private static final int DEFAULT_GAP = 10;
private FormDesigner designer; private FormDesigner designer;
private XLayoutContainer parent; // 当前选中的那些组件所在父容器
private List<XCreator> selectedCreators; private List<XCreator> selectedCreators;
private Rectangle rec; private Rectangle rec;
public MultiSelectionArrangement(FormDesigner designer) { public MultiSelectionArrangement(FormDesigner designer) {
this.designer = designer; this.designer = designer;
update();
} }
public void leftAlign() { public void doArrangement(ArrangementType type) {
doArrangement(type, DEFAULT_GAP);
}
public void doArrangement(ArrangementType type, int gap) {
updatePosition();
switch (type) {
case RIGHT_ALIGN:
rightAlign();
break;
case TOP_ALIGN:
topAlign();
break;
case BOTTOM_ALIGN:
bottomAlign();
break;
case HORIZONTAL_CENTER_ALIGN:
horizontalCenterAlign();
break;
case VERTICAL_CENTER_ALIGN:
verticalCenterAlign();
break;
case HORIZONTAL_AUTO_DISTRIBUTION:
horizontalAutoDistribution();
break;
case HORIZONTAL_MANUAL_DISTRIBUTION:
horizontalManualDistribution(gap);
break;
case VERTICAL_AUTO_DISTRIBUTION:
verticalAutoDistribution();
break;
case VERTICAL_MANUAL_DISTRIBUTION:
verticalManualDistribution(gap);
break;
case LEFT_ALIGN:
default:
leftAlign();
break;
}
updateModel();
}
private void leftAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x, creator.getY()); creator.setLocation(rec.x, creator.getY());
} }
update();
} }
public void rightAlign() { private void rightAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x + rec.width - creator.getWidth(), creator.getY()); creator.setLocation(rec.x + rec.width - creator.getWidth(), creator.getY());
} }
update();
} }
public void topAlign() { private void topAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y); creator.setLocation(creator.getX(), rec.y);
} }
update();
} }
public void bottomAlign() { private void bottomAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y + rec.height - creator.getHeight()); creator.setLocation(creator.getX(), rec.y + rec.height - creator.getHeight());
} }
update();
} }
public void horizontalCenterAlign() { private void horizontalCenterAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x + rec.width / 2 - creator.getWidth() / 2, creator.getY()); creator.setLocation(rec.x + rec.width / 2 - creator.getWidth() / 2, creator.getY());
} }
update();
} }
public void verticalCenterAlign() { private void verticalCenterAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y + rec.height / 2 - creator.getHeight() / 2); creator.setLocation(creator.getX(), rec.y + rec.height / 2 - creator.getHeight() / 2);
} }
update();
} }
// 水平分布,自动,间距由selectedCreators和border共同计算而来 // 水平分布,自动,间距由selectedCreators和border共同计算而来
public void horizontalAutoDistribution() { private void horizontalAutoDistribution() {
sortHorizontal(); sortHorizontal();
int[] gaps = calculateHorizontalGaps(); int[] gaps = calculateHorizontalGaps();
horizontalDistribution(gaps); horizontalDistribution(gaps);
} }
// 水平分布,手动,传入一个间距,排列selectedCreators // 水平分布,手动,传入一个间距,排列selectedCreators
public void horizontalManualDistribution(int gap) { private void horizontalManualDistribution(int gap) {
sortHorizontal(); sortHorizontal();
reSizeRecByHorizontal(gap); reSizeRecByHorizontal(gap);
horizontalDistribution(fillGaps(gap, selectedCreators.size() - 1)); horizontalDistribution(fillGaps(gap, selectedCreators.size() - 1));
@ -87,7 +123,6 @@ public class MultiSelectionArrangement {
XCreator preCreator = selectedCreators.get(i - 1); XCreator preCreator = selectedCreators.get(i - 1);
creator.setLocation(preCreator.getX() + preCreator.getWidth() + gaps[i - 1], creator.getY()); creator.setLocation(preCreator.getX() + preCreator.getWidth() + gaps[i - 1], creator.getY());
} }
update();
} }
private void reSizeRecByHorizontal(int gap) { private void reSizeRecByHorizontal(int gap) {
@ -145,13 +180,13 @@ public class MultiSelectionArrangement {
return calculateIntegerGaps(distanceBetweenHeadAndTailCreators - sum, gapCount); return calculateIntegerGaps(distanceBetweenHeadAndTailCreators - sum, gapCount);
} }
public void verticalAutoDistribution() { private void verticalAutoDistribution() {
sortVertical(); sortVertical();
int[] gaps = calculateVerticalGaps(); int[] gaps = calculateVerticalGaps();
verticalDistribution(gaps); verticalDistribution(gaps);
} }
public void verticalManualDistribution(int gap) { private void verticalManualDistribution(int gap) {
sortVertical(); sortVertical();
reSizeRecByVertical(gap); reSizeRecByVertical(gap);
verticalDistribution(fillGaps(gap, selectedCreators.size() - 1)); verticalDistribution(fillGaps(gap, selectedCreators.size() - 1));
@ -163,7 +198,6 @@ public class MultiSelectionArrangement {
XCreator preCreator = selectedCreators.get(i - 1); XCreator preCreator = selectedCreators.get(i - 1);
creator.setLocation(creator.getX(), preCreator.getY() + preCreator.getHeight() + gaps[i - 1]); creator.setLocation(creator.getX(), preCreator.getY() + preCreator.getHeight() + gaps[i - 1]);
} }
update();
} }
private void reSizeRecByVertical(int gap) { private void reSizeRecByVertical(int gap) {
@ -252,12 +286,15 @@ public class MultiSelectionArrangement {
return gaps; return gaps;
} }
private void update() { private void updatePosition() {
FormSelection selection = designer.getSelectionModel().getSelection(); FormSelection selection = designer.getSelectionModel().getSelection();
this.selectedCreators = Arrays.asList(selection.getSelectedCreators()); this.selectedCreators = Arrays.asList(selection.getSelectedCreators());
this.rec = selection.getSelctionBounds(); this.rec = selection.getSelctionBounds();
this.parent = getParent(selection.getSelectedCreator()); }
private void updateModel() {
FormSelection selection = designer.getSelectionModel().getSelection();
XLayoutContainer parent = getParent(selection.getSelectedCreator());
if (parent != null) { if (parent != null) {
// 这里要修改修改engine里面的对象才能成功保存,光修改设计器对象没用 // 这里要修改修改engine里面的对象才能成功保存,光修改设计器对象没用
WLayout wabs = parent.toData(); WLayout wabs = parent.toData();

14
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java

@ -5,6 +5,9 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public abstract class AbstractMultiSelectionArrangementButton extends UIButton implements MultiSelectionArrangementButton, UIObserver { public abstract class AbstractMultiSelectionArrangementButton extends UIButton implements MultiSelectionArrangementButton, UIObserver {
private static final long serialVersionUID = -2114423583742242771L; private static final long serialVersionUID = -2114423583742242771L;
protected MultiSelectionArrangement arrangement; protected MultiSelectionArrangement arrangement;
@ -29,4 +32,15 @@ public abstract class AbstractMultiSelectionArrangementButton extends UIButton i
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
@Override
public ActionListener getActionListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
arrangement.doArrangement(getArrangementType());
uiObserverListener.doChange();
}
};
}
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BottomAlignButton extends AbstractMultiSelectionArrangementButton { public class BottomAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 2397455240682353024L;
public BottomAlignButton(MultiSelectionArrangement arrangement) { public BottomAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class BottomAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.BOTTOM_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.bottomAlign();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class HorizontalCenterButton extends AbstractMultiSelectionArrangementButton { public class HorizontalCenterButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 6290178236460051049L;
public HorizontalCenterButton(MultiSelectionArrangement arrangement) { public HorizontalCenterButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class HorizontalCenterButton extends AbstractMultiSelectionArrangementBut
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.HORIZONTAL_CENTER_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.horizontalCenterAlign();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class HorizontalDistributionButton extends AbstractMultiSelectionArrangementButton { public class HorizontalDistributionButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 5052092252720664954L;
public HorizontalDistributionButton(MultiSelectionArrangement arrangement) { public HorizontalDistributionButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class HorizontalDistributionButton extends AbstractMultiSelectionArrangem
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.HORIZONTAL_AUTO_DISTRIBUTION;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.horizontalAutoDistribution();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class LeftAlignButton extends AbstractMultiSelectionArrangementButton { public class LeftAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = -8177637788632733710L;
public LeftAlignButton(MultiSelectionArrangement arrangement) { public LeftAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class LeftAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.LEFT_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.leftAlign();
uiObserverListener.doChange();
}
};
} }
} }

4
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.mainframe.ArrangementType;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -9,4 +11,6 @@ public interface MultiSelectionArrangementButton {
String getTipText(); String getTipText();
ActionListener getActionListener(); ActionListener getActionListener();
ArrangementType getArrangementType();
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class RightAlignButton extends AbstractMultiSelectionArrangementButton { public class RightAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = -8698936349956288409L;
public RightAlignButton(MultiSelectionArrangement arrangement) { public RightAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class RightAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.RIGHT_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.rightAlign();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class TopAlignButton extends AbstractMultiSelectionArrangementButton { public class TopAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 2896267783075870924L;
public TopAlignButton(MultiSelectionArrangement arrangement) { public TopAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class TopAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.TOP_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.topAlign();
uiObserverListener.doChange();
}
};
} }
} }

13
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java

@ -1,12 +1,11 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VerticalCenterButton extends AbstractMultiSelectionArrangementButton { public class VerticalCenterButton extends AbstractMultiSelectionArrangementButton {
public VerticalCenterButton(MultiSelectionArrangement arrangement) { public VerticalCenterButton(MultiSelectionArrangement arrangement) {
@ -24,13 +23,7 @@ public class VerticalCenterButton extends AbstractMultiSelectionArrangementButto
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.VERTICAL_CENTER_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.verticalCenterAlign();
uiObserverListener.doChange();
}
};
} }
} }

13
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java

@ -1,12 +1,11 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VerticalDistributionButton extends AbstractMultiSelectionArrangementButton { public class VerticalDistributionButton extends AbstractMultiSelectionArrangementButton {
public VerticalDistributionButton(MultiSelectionArrangement arrangement) { public VerticalDistributionButton(MultiSelectionArrangement arrangement) {
@ -24,13 +23,7 @@ public class VerticalDistributionButton extends AbstractMultiSelectionArrangemen
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.VERTICAL_AUTO_DISTRIBUTION;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.verticalAutoDistribution();
uiObserverListener.doChange();
}
};
} }
} }

5
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

@ -9,6 +9,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.design.mainframe.widget.arrangement.buttons.BottomAlignButton; import com.fr.design.mainframe.widget.arrangement.buttons.BottomAlignButton;
@ -186,9 +187,9 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
int gap = (int) Math.floor(Float.parseFloat(text)); int gap = (int) Math.floor(Float.parseFloat(text));
numberField.setValue(gap); numberField.setValue(gap);
if (isVertical) { if (isVertical) {
arrangement.verticalManualDistribution(gap); arrangement.doArrangement(ArrangementType.VERTICAL_MANUAL_DISTRIBUTION, gap);
} else { } else {
arrangement.horizontalManualDistribution(gap); arrangement.doArrangement(ArrangementType.HORIZONTAL_MANUAL_DISTRIBUTION, gap);
} }
attributeChanged(); attributeChanged();
} }

Loading…
Cancel
Save