方磊
3 years ago
14 changed files with 352 additions and 114 deletions
@ -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; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue