|
|
@ -1,8 +1,10 @@ |
|
|
|
package com.fr.design.mainframe.widget.ui; |
|
|
|
package com.fr.design.mainframe.widget.ui; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.designer.beans.events.DesignerEvent; |
|
|
|
|
|
|
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.itextfield.UIPositiveAndNegativeIntNumberField; |
|
|
|
import com.fr.design.gui.itextfield.UIIntNumberField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
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; |
|
|
@ -19,6 +21,7 @@ import com.fr.design.mainframe.widget.arrangement.buttons.VerticalCenterButton; |
|
|
|
import com.fr.design.mainframe.widget.arrangement.buttons.VerticalDistributionButton; |
|
|
|
import com.fr.design.mainframe.widget.arrangement.buttons.VerticalDistributionButton; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
@ -30,6 +33,7 @@ import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
|
|
|
|
|
|
|
|
public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
|
|
|
|
private AttributeChangeListener listener; |
|
|
|
private MultiSelectionArrangement arrangement; |
|
|
|
private MultiSelectionArrangement arrangement; |
|
|
|
|
|
|
|
|
|
|
|
public FormMultiWidgetCardPane(FormDesigner designer) { |
|
|
|
public FormMultiWidgetCardPane(FormDesigner designer) { |
|
|
@ -40,6 +44,12 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
arrangement = new MultiSelectionArrangement(designer); |
|
|
|
arrangement = new MultiSelectionArrangement(designer); |
|
|
|
content.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); |
|
|
|
content.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); |
|
|
|
content.add(createArrangementLayoutPane(), BorderLayout.CENTER); |
|
|
|
content.add(createArrangementLayoutPane(), BorderLayout.CENTER); |
|
|
|
|
|
|
|
this.listener = new AttributeChangeListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void attributeChange() { |
|
|
|
|
|
|
|
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_RESIZED); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 整个排列分布面板的layout,可以看成一个三行一列的表格,第一行是分布,第二行是自动间距,第三行是手动间距
|
|
|
|
// 整个排列分布面板的layout,可以看成一个三行一列的表格,第一行是分布,第二行是自动间距,第三行是手动间距
|
|
|
@ -73,12 +83,12 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
}; |
|
|
|
}; |
|
|
|
Component[][] components = new Component[][] { |
|
|
|
Component[][] components = new Component[][] { |
|
|
|
new Component[] { |
|
|
|
new Component[] { |
|
|
|
new LeftAlignButton(arrangement).create(), |
|
|
|
new LeftAlignButton(arrangement), |
|
|
|
new HorizontalCenterButton(arrangement).create(), |
|
|
|
new HorizontalCenterButton(arrangement), |
|
|
|
new RightAlignButton(arrangement).create(), |
|
|
|
new RightAlignButton(arrangement), |
|
|
|
new TopAlignButton(arrangement).create(), |
|
|
|
new TopAlignButton(arrangement), |
|
|
|
new VerticalCenterButton(arrangement).create(), |
|
|
|
new VerticalCenterButton(arrangement), |
|
|
|
new BottomAlignButton(arrangement).create() |
|
|
|
new BottomAlignButton(arrangement) |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0); |
|
|
|
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0); |
|
|
@ -92,8 +102,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
TableLayout.PREFERRED, |
|
|
|
TableLayout.PREFERRED, |
|
|
|
TableLayout.PREFERRED |
|
|
|
TableLayout.PREFERRED |
|
|
|
}; |
|
|
|
}; |
|
|
|
UIButton horizontalAutoSpacingBtn = new HorizontalDistributionButton(arrangement).create(); |
|
|
|
UIButton horizontalAutoSpacingBtn = new HorizontalDistributionButton(arrangement); |
|
|
|
UIButton verticalAutoSpacingBtn = new VerticalDistributionButton(arrangement).create(); |
|
|
|
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); |
|
|
@ -147,8 +157,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Spacing"), centerPane); |
|
|
|
return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Spacing"), centerPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private UIPositiveAndNegativeIntNumberField createIntNumberField(boolean isVertical) { |
|
|
|
private UIIntNumberField createIntNumberField(boolean isVertical) { |
|
|
|
final UIPositiveAndNegativeIntNumberField intNumberField = new UIPositiveAndNegativeIntNumberField(); |
|
|
|
final UIIntNumberField intNumberField = new UIIntNumberField(); |
|
|
|
intNumberField.addFocusListener(new FocusAdapter() { |
|
|
|
intNumberField.addFocusListener(new FocusAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
@ -167,12 +177,13 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void distributionDoChange(String text, boolean isVertical) { |
|
|
|
private void distributionDoChange(String text, boolean isVertical) { |
|
|
|
if (StableUtils.isNumber(text)) { |
|
|
|
if (StringUtils.isNotEmpty(text) && StableUtils.isNumber(text)) { |
|
|
|
if (isVertical) { |
|
|
|
if (isVertical) { |
|
|
|
arrangement.verticalManualDistribution(Math.round(Float.parseFloat(text))); |
|
|
|
arrangement.verticalManualDistribution(Math.round(Float.parseFloat(text))); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
arrangement.horizontalManualDistribution(Math.round(Float.parseFloat(text))); |
|
|
|
arrangement.horizontalManualDistribution(Math.round(Float.parseFloat(text))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
attributeChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -184,4 +195,10 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { |
|
|
|
jPanel.add(centerPane, BorderLayout.CENTER); |
|
|
|
jPanel.add(centerPane, BorderLayout.CENTER); |
|
|
|
return jPanel; |
|
|
|
return jPanel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void populate() { |
|
|
|
|
|
|
|
initListener(this); |
|
|
|
|
|
|
|
this.addAttributeChangeListener(listener); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|