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