From 6ecdf5a8d96dd78514f7ddb87ed9c025ab9f5b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 4 Aug 2021 16:04:16 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-54885=20=E3=80=9010.0.19=E3=80=91FRM?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E6=8E=A8=E8=8D=90=E4=B9=8B=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 2 +- .../com/fr/design/mainframe/FormDesigner.java | 4 +- .../mainframe/FormSpacingLineDrawer.java | 16 ++- ...stractMultiSelectionArrangementButton.java | 23 ++++ .../buttons/BottomAlignButton.java | 35 +++++ .../buttons/HorizontalCenterButton.java | 35 +++++ .../buttons/HorizontalDistributionButton.java | 35 +++++ .../arrangement/buttons/LeftAlignButton.java | 35 +++++ .../MultiSelectionArrangementButton.java | 16 +++ .../arrangement/buttons/RightAlignButton.java | 35 +++++ .../arrangement/buttons/TopAlignButton.java | 35 +++++ .../buttons/VerticalCenterButton.java | 35 +++++ .../buttons/VerticalDistributionButton.java | 35 +++++ .../widget/ui/FormMultiWidgetCardPane.java | 125 +++--------------- 14 files changed, 352 insertions(+), 114 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 711a7a58d..8980c09a1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -862,7 +862,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } - public boolean isInAbsoluteContainer() { + public boolean isParentAbsolute() { return ((XCreator) this.getParent()).acceptType(XWAbsoluteLayout.class); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index af8efcd26..9f49de1d8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1770,11 +1770,11 @@ public class FormDesigner extends TargetComponent
implements TreeSelection XCreator[] creators = this.getSelectionModel().getSelection().getSelectedCreators(); if (creators != null && creators.length > 1) { for (int i = 0; i < creators.length - 1; i++) { - if (creators[i].getParent() != creators[i + 1].getParent() || !creators[i].isInAbsoluteContainer()) { + if (creators[i].getParent() != creators[i + 1].getParent() || !creators[i].isParentAbsolute()) { return false; } } - return creators[creators.length - 1].isInAbsoluteContainer(); + return creators[creators.length - 1].isParentAbsolute(); } return false; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java index a9f01dcad..806161319 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java @@ -36,11 +36,11 @@ public class FormSpacingLineDrawer { public void draw(Graphics g) { this.selectedRec = designer.getSelectionModel().getSelection().getSelctionBounds(); - if (isSelectedForm() || isSelectedRootComponent() || isHoveredForm() || isHoveredRootComponent() || !isMouseMoveEvent) { + if (!isDrawSpacingLine()) { return; } - if (!hoverCreator.isInAbsoluteContainer()) { + if (!hoverCreator.isParentAbsolute()) { return; } @@ -259,4 +259,16 @@ public class FormSpacingLineDrawer { private boolean isHoveredCreatorRightYSpacingLine() { return hoverCreator.getX() > selectedRec.x + selectedRec.width / 2; } + + private boolean isSelectedRootPane() { + return isSelectedForm() || isSelectedRootComponent(); + } + + private boolean isHoveredRootPane() { + return isHoveredForm() || isHoveredRootComponent(); + } + + private boolean isDrawSpacingLine() { + return !isSelectedRootPane() && !isHoveredRootPane() && isMouseMoveEvent; + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java new file mode 100644 index 000000000..ac687d425 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java @@ -0,0 +1,23 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.mainframe.MultiSelectionArrangement; + +public abstract class AbstractMultiSelectionArrangementButton implements MultiSelectionArrangementButton { + protected MultiSelectionArrangement arrangement; + + public AbstractMultiSelectionArrangementButton(MultiSelectionArrangement arrangement) { + this.arrangement = arrangement; + } + + @Override + public UIButton create() { + UIButton btn = new UIButton(); + btn.setNormalPainted(false); + btn.setBorderPaintedOnlyWhenPressed(true); + btn.setIcon(getIcon()); + btn.setToolTipText(getTipText()); + btn.addActionListener(getActionListener()); + return btn; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java new file mode 100644 index 000000000..41318ff67 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class BottomAlignButton extends AbstractMultiSelectionArrangementButton { + public BottomAlignButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_bottom_align.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Bottom_Align"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.bottomAlign(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java new file mode 100644 index 000000000..7eface48f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class HorizontalCenterButton extends AbstractMultiSelectionArrangementButton { + public HorizontalCenterButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_center_align.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Horizontal_Center_Align"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.horizontalCenterAlign(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java new file mode 100644 index 000000000..678ce895b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class HorizontalDistributionButton extends AbstractMultiSelectionArrangementButton { + public HorizontalDistributionButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_auto_spacing.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Horizontal_Spacing"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.horizontalAutoDistribution(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java new file mode 100644 index 000000000..3f8d685c7 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class LeftAlignButton extends AbstractMultiSelectionArrangementButton { + public LeftAlignButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_left_align.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Left_Align"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.leftAlign(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java new file mode 100644 index 000000000..06bc2026b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java @@ -0,0 +1,16 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.gui.ibutton.UIButton; + +import javax.swing.Icon; +import java.awt.event.ActionListener; + +public interface MultiSelectionArrangementButton { + Icon getIcon(); + + String getTipText(); + + ActionListener getActionListener(); + + UIButton create(); +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java new file mode 100644 index 000000000..02f20fc45 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class RightAlignButton extends AbstractMultiSelectionArrangementButton { + public RightAlignButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_right_align.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Right_Align"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.rightAlign(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java new file mode 100644 index 000000000..7100b3b96 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class TopAlignButton extends AbstractMultiSelectionArrangementButton { + public TopAlignButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_top_align.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Top_Align"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.topAlign(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java new file mode 100644 index 000000000..81d86d558 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class VerticalCenterButton extends AbstractMultiSelectionArrangementButton { + public VerticalCenterButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_vertical_center_align.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Vertical_Center_Align"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.verticalCenterAlign(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java new file mode 100644 index 000000000..538463b6b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.widget.arrangement.buttons; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.general.IOUtils; + +import javax.swing.Icon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class VerticalDistributionButton extends AbstractMultiSelectionArrangementButton { + public VerticalDistributionButton(MultiSelectionArrangement arrangement) { + super(arrangement); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_vertical_auto_spacing.png"); + } + + @Override + public String getTipText() { + return Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Vertical_Spacing"); + } + + @Override + public ActionListener getActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + arrangement.verticalAutoDistribution(); + } + }; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java index ba7c5156e..77e6a67d8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java @@ -9,6 +9,14 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.MultiSelectionArrangement; +import com.fr.design.mainframe.widget.arrangement.buttons.BottomAlignButton; +import com.fr.design.mainframe.widget.arrangement.buttons.HorizontalCenterButton; +import com.fr.design.mainframe.widget.arrangement.buttons.HorizontalDistributionButton; +import com.fr.design.mainframe.widget.arrangement.buttons.LeftAlignButton; +import com.fr.design.mainframe.widget.arrangement.buttons.RightAlignButton; +import com.fr.design.mainframe.widget.arrangement.buttons.TopAlignButton; +import com.fr.design.mainframe.widget.arrangement.buttons.VerticalCenterButton; +import com.fr.design.mainframe.widget.arrangement.buttons.VerticalDistributionButton; import com.fr.general.IOUtils; import com.fr.stable.StableUtils; @@ -16,21 +24,10 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; public class FormMultiWidgetCardPane extends FormWidgetCardPane { - private static final int LEFT_ALIGN = 1; - private static final int RIGHT_ALIGN = 2; - private static final int HORIZONTAL_CENTER_ALIGN = 3; - private static final int TOP_ALIGN = 4; - private static final int BOTTOM_ALIGN = 5; - private static final int VERTICAL_CENTER_ALIGN = 6; - private static final int HORIZONTAL_AUTO_SPACING = 7; - private static final int VERTICAL_AUTO_SPACING = 8; - private MultiSelectionArrangement arrangement; public FormMultiWidgetCardPane(FormDesigner designer) { @@ -74,12 +71,12 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { }; Component[][] components = new Component[][] { new Component[] { - createArrangementButton(LEFT_ALIGN), - createArrangementButton(HORIZONTAL_CENTER_ALIGN), - createArrangementButton(RIGHT_ALIGN), - createArrangementButton(TOP_ALIGN), - createArrangementButton(VERTICAL_CENTER_ALIGN), - createArrangementButton(BOTTOM_ALIGN) + new LeftAlignButton(arrangement).create(), + new HorizontalCenterButton(arrangement).create(), + new RightAlignButton(arrangement).create(), + new TopAlignButton(arrangement).create(), + new VerticalCenterButton(arrangement).create(), + new BottomAlignButton(arrangement).create() } }; JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0); @@ -93,8 +90,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { TableLayout.PREFERRED, TableLayout.PREFERRED }; - UIButton horizontalAutoSpacingBtn = createArrangementButton(HORIZONTAL_AUTO_SPACING); - UIButton verticalAutoSpacingBtn = createArrangementButton(VERTICAL_AUTO_SPACING); + UIButton horizontalAutoSpacingBtn = new HorizontalDistributionButton(arrangement).create(); + UIButton verticalAutoSpacingBtn = new VerticalDistributionButton(arrangement).create(); if (designer.getSelectionModel().getSelection().size() < 3) { horizontalAutoSpacingBtn.setEnabled(false); verticalAutoSpacingBtn.setEnabled(false); @@ -178,94 +175,4 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { jPanel.add(centerPane, BorderLayout.CENTER); return jPanel; } - - private UIButton createArrangementButton(int btnType) { - UIButton btn = new UIButton(); - btn.setNormalPainted(false); - btn.setBorderPaintedOnlyWhenPressed(true); - switch (btnType) { - case LEFT_ALIGN: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_left_align.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Left_Align")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.leftAlign(); - } - }); - break; - case RIGHT_ALIGN: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_right_align.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Right_Align")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.rightAlign(); - } - }); - break; - case TOP_ALIGN: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_top_align.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Top_Align")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.topAlign(); - } - }); - break; - case BOTTOM_ALIGN: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_bottom_align.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Bottom_Align")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.bottomAlign(); - } - }); - break; - case HORIZONTAL_CENTER_ALIGN: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_center_align.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Horizontal_Center_Align")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.horizontalCenterAlign(); - } - }); - break; - case VERTICAL_CENTER_ALIGN: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_vertical_center_align.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Vertical_Center_Align")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.verticalCenterAlign(); - } - }); - break; - case HORIZONTAL_AUTO_SPACING: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_auto_spacing.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Horizontal_Spacing")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.horizontalAutoDistribution(); - } - }); - break; - case VERTICAL_AUTO_SPACING: - btn.setIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_vertical_auto_spacing.png")); - btn.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Vertical_Spacing")); - btn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - arrangement.verticalAutoDistribution(); - } - }); - break; - default: break; - } - return btn; - } }