|
|
|
@ -1,8 +1,11 @@
|
|
|
|
|
package com.fr.design.widget.ui.designer; |
|
|
|
|
|
|
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
|
import com.fr.design.designer.IntervalConstants; |
|
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
|
import com.fr.design.fun.WidgetAdvancedPaneProvider; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
@ -11,18 +14,28 @@ import com.fr.design.layout.TableLayoutHelper;
|
|
|
|
|
import com.fr.design.widget.ui.designer.component.FontSizeComboPane; |
|
|
|
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
|
|
|
|
import com.fr.form.ui.CheckBox; |
|
|
|
|
|
|
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
|
import com.fr.plugin.observer.PluginEvent; |
|
|
|
|
import com.fr.plugin.observer.PluginEventListener; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
|
|
|
|
private UITextField text; |
|
|
|
|
private FontSizeComboPane fontSizePane; |
|
|
|
|
private FormWidgetValuePane formWidgetValuePane; |
|
|
|
|
protected UITextField labelNameTextField; |
|
|
|
|
protected final List<BasicBeanPane<CheckBox>> extraPaneList = new ArrayList<>(); |
|
|
|
|
protected JPanel extraPane; |
|
|
|
|
|
|
|
|
|
protected static double F = TableLayout.FILL; |
|
|
|
|
protected static double P = TableLayout.PREFERRED; |
|
|
|
|
|
|
|
|
|
public CheckBoxDefinePane(XCreator xCreator) { |
|
|
|
|
super(xCreator); |
|
|
|
@ -37,16 +50,15 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
|
|
|
|
|
UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); |
|
|
|
|
widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); |
|
|
|
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
initExtraPane(); |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text }, |
|
|
|
|
new Component[]{widgetValueLabel, formWidgetValuePane }, |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}, |
|
|
|
|
new Component[]{extraPane, null}, |
|
|
|
|
}; |
|
|
|
|
double[] rowSize = {p, p, p, p, p, p}; |
|
|
|
|
double[] columnSize = {p, f}; |
|
|
|
|
double[] rowSize = {P, P, P, P, P, P}; |
|
|
|
|
double[] columnSize = {P, F}; |
|
|
|
|
int[][] rowCount = {{1, 1},{1, 1}, {1, 3},{1, 1}}; |
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); |
|
|
|
|
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
@ -56,6 +68,59 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
|
|
|
|
|
|
|
|
|
|
this.add(uiExpandablePane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void initExtraPane() { |
|
|
|
|
initPluginListener(); |
|
|
|
|
refreshExtraAdvancedPane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void refreshExtraAdvancedPane() { |
|
|
|
|
extraPaneList.clear(); |
|
|
|
|
boolean containsExtraPane = false; |
|
|
|
|
Set<WidgetAdvancedPaneProvider<CheckBox>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); |
|
|
|
|
for (WidgetAdvancedPaneProvider<CheckBox> provider : providers) { |
|
|
|
|
if (!provider.accept(creator)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); |
|
|
|
|
containsExtraPane = true; |
|
|
|
|
} |
|
|
|
|
if (containsExtraPane) { |
|
|
|
|
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); |
|
|
|
|
for (BasicBeanPane<CheckBox> pane : extraPaneList) { |
|
|
|
|
extraPane.add(pane); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} |
|
|
|
|
}; |
|
|
|
|
double[] rowSize = {P}; |
|
|
|
|
double[] columnSize = {P, F}; |
|
|
|
|
int[][] rowCount = {{1, 1}}; |
|
|
|
|
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void initPluginListener() { |
|
|
|
|
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { |
|
|
|
|
@Override |
|
|
|
|
public void on(PluginEvent event) { |
|
|
|
|
refreshExtraAdvancedPane(); |
|
|
|
|
} |
|
|
|
|
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 插入配置项面板 |
|
|
|
|
* |
|
|
|
|
* @param index 插入的位置 |
|
|
|
|
* @param pane 配置项面板 |
|
|
|
|
*/ |
|
|
|
|
protected void insertShortCut(int index, BasicBeanPane<CheckBox> pane) { |
|
|
|
|
int size = extraPaneList.size(); |
|
|
|
|
index = Math.min(index, size); |
|
|
|
|
extraPaneList.add(index, pane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String title4PopupWindow() { |
|
|
|
@ -68,6 +133,9 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
|
|
|
|
|
fontSizePane.setValue(check.getFontSize()); |
|
|
|
|
formWidgetValuePane.populate(check); |
|
|
|
|
labelNameTextField.setText(check.getLabelName()); |
|
|
|
|
for (BasicBeanPane<CheckBox> pane : extraPaneList) { |
|
|
|
|
pane.populateBean(check); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -77,6 +145,9 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
|
|
|
|
|
box.setFontSize(fontSizePane.getValue()); |
|
|
|
|
formWidgetValuePane.update(box); |
|
|
|
|
box.setLabelName(labelNameTextField.getText()); |
|
|
|
|
for (BasicBeanPane<CheckBox> pane : extraPaneList) { |
|
|
|
|
pane.updateBean(box); |
|
|
|
|
} |
|
|
|
|
return box; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|