|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
package com.fr.design.mainframe.widget.ui; |
|
|
|
|
|
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
import com.fine.theme.utils.FineLayoutBuilder; |
|
|
|
|
import com.formdev.flatlaf.util.ScaledEmptyBorder; |
|
|
|
|
import com.fr.design.designer.beans.events.DesignerEvent; |
|
|
|
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
@ -24,7 +27,6 @@ import com.fr.general.IOUtils;
|
|
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Component; |
|
|
|
@ -43,93 +45,46 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
|
|
|
|
|
|
|
|
|
|
public void initPropertyPane() { |
|
|
|
|
arrangement = new MultiSelectionArrangement(designer); |
|
|
|
|
content.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); |
|
|
|
|
content.add(createArrangementLayoutPane(), BorderLayout.CENTER); |
|
|
|
|
this.listener = new AttributeChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void attributeChange() { |
|
|
|
|
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_RESIZED); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); |
|
|
|
|
this.listener = () -> designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_RESIZED); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 整个排列分布面板的layout,可以看成一个三行一列的表格,第一行是分布,第二行是自动间距,第三行是手动间距
|
|
|
|
|
/** |
|
|
|
|
* 整个排列分布面板的layout,可以看成一个两行一列的表格,第一行是分布,第二行是自动间距 |
|
|
|
|
*/ |
|
|
|
|
private JPanel createArrangementLayoutPane() { |
|
|
|
|
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; |
|
|
|
|
double[] columnSize = {TableLayout.PREFERRED}; |
|
|
|
|
Component[][] components = new Component[][] { |
|
|
|
|
new Component[] { |
|
|
|
|
createAlignmentPane() |
|
|
|
|
}, |
|
|
|
|
new Component[] { |
|
|
|
|
createAutoSpacingPane() |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 16); |
|
|
|
|
return FineLayoutBuilder.createVerticalLayout(10, createAlignmentPane(), createAutoSpacingPane()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 对齐
|
|
|
|
|
private JPanel createAlignmentPane() { |
|
|
|
|
double[] rowSize = {TableLayout.PREFERRED}; |
|
|
|
|
double[] columnSize = { |
|
|
|
|
TableLayout.PREFERRED, |
|
|
|
|
TableLayout.PREFERRED, |
|
|
|
|
TableLayout.PREFERRED, |
|
|
|
|
TableLayout.PREFERRED, |
|
|
|
|
TableLayout.PREFERRED, |
|
|
|
|
TableLayout.PREFERRED |
|
|
|
|
}; |
|
|
|
|
Component[][] components = new Component[][] { |
|
|
|
|
new Component[] { |
|
|
|
|
JPanel centerPane = FineLayoutBuilder.createHorizontalLayout(16, |
|
|
|
|
new LeftAlignButton(arrangement), |
|
|
|
|
new HorizontalCenterButton(arrangement), |
|
|
|
|
new RightAlignButton(arrangement), |
|
|
|
|
new TopAlignButton(arrangement), |
|
|
|
|
new VerticalCenterButton(arrangement), |
|
|
|
|
new BottomAlignButton(arrangement) |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0); |
|
|
|
|
new BottomAlignButton(arrangement)); |
|
|
|
|
|
|
|
|
|
return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Align"), centerPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 自动间距
|
|
|
|
|
private JPanel createAutoSpacingPane() { |
|
|
|
|
double[] rowSize = {TableLayout.PREFERRED}; |
|
|
|
|
double[] columnSize = { |
|
|
|
|
TableLayout.PREFERRED, |
|
|
|
|
TableLayout.PREFERRED |
|
|
|
|
}; |
|
|
|
|
UIButton horizontalAutoSpacingBtn = new HorizontalDistributionButton(arrangement); |
|
|
|
|
UIButton verticalAutoSpacingBtn = new VerticalDistributionButton(arrangement); |
|
|
|
|
if (designer.getSelectionModel().getSelection().size() < 3) { |
|
|
|
|
horizontalAutoSpacingBtn.setEnabled(false); |
|
|
|
|
verticalAutoSpacingBtn.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
Component[][] components = new Component[][] { |
|
|
|
|
new Component[] { |
|
|
|
|
horizontalAutoSpacingBtn, |
|
|
|
|
verticalAutoSpacingBtn |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0); |
|
|
|
|
JPanel centerPane = FineLayoutBuilder.createHorizontalLayout(16, horizontalAutoSpacingBtn, verticalAutoSpacingBtn); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UILabel tip = new UILabel(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_auto_spacing_tip.png")); |
|
|
|
|
UILabel tip = new UILabel(new LazyIcon("jumpHelp", 12)); |
|
|
|
|
tip.setToolTipText(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Spacing_Tip")); |
|
|
|
|
Component[][] titleComponents = new Component[][] { |
|
|
|
|
new Component[] { |
|
|
|
|
new UILabel(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Spacing")), |
|
|
|
|
tip |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(titleComponents, rowSize, columnSize, 5, 0); |
|
|
|
|
JPanel northPane = FineLayoutBuilder.createHorizontalLayout(5, new UILabel(Toolkit.i18nText("Fine-Design_Multi_Selection_Auto_Spacing")), tip); |
|
|
|
|
|
|
|
|
|
JPanel jPanel = new JPanel(); |
|
|
|
|
jPanel.setLayout(new BorderLayout(0, 8)); |
|
|
|
|
jPanel.add(northPane, BorderLayout.NORTH); |
|
|
|
|
jPanel.add(centerPane, BorderLayout.CENTER); |
|
|
|
|
return jPanel; |
|
|
|
|
return FineLayoutBuilder.createVerticalLayout(10, northPane, centerPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 手动间距
|
|
|
|
@ -195,13 +150,11 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 创建一个BorderLayout布局,上面是标题,例如“对齐”,下面是个容器
|
|
|
|
|
/** |
|
|
|
|
* 创建一个面板,上面是标题,例如“对齐”,下面是个容器 |
|
|
|
|
*/ |
|
|
|
|
private JPanel createTitleLayout(String title, JPanel centerPane) { |
|
|
|
|
JPanel jPanel = new JPanel(); |
|
|
|
|
jPanel.setLayout(new BorderLayout(0, 8)); |
|
|
|
|
jPanel.add(new UILabel(title), BorderLayout.NORTH); |
|
|
|
|
jPanel.add(centerPane, BorderLayout.CENTER); |
|
|
|
|
return jPanel; |
|
|
|
|
return FineLayoutBuilder.createVerticalLayout(10, new UILabel(title), centerPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|