|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.fr.design.widget; |
|
|
|
|
|
|
|
|
|
import com.formdev.flatlaf.util.ScaledEmptyBorder; |
|
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
|
import com.fr.design.fun.WidgetDesignHandler; |
|
|
|
|
import com.fr.design.gui.core.WidgetOption; |
|
|
|
@ -9,27 +10,36 @@ import com.fr.design.gui.icombobox.UIComboBox;
|
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.mainframe.CellWidgetPropertyPane; |
|
|
|
|
import com.fr.design.mainframe.ElementCasePane; |
|
|
|
|
import com.fr.design.widget.btn.ButtonConstants; |
|
|
|
|
import com.fr.form.ui.Button; |
|
|
|
|
import com.fr.form.ui.*; |
|
|
|
|
import com.fr.form.ui.NameWidget; |
|
|
|
|
import com.fr.form.ui.Widget; |
|
|
|
|
import com.fr.form.ui.WidgetConfig; |
|
|
|
|
import com.fr.form.ui.WidgetInfoConfig; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import javax.swing.DefaultComboBoxModel; |
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JList; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.event.PopupMenuEvent; |
|
|
|
|
import javax.swing.event.PopupMenuListener; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
|
import java.awt.event.ItemListener; |
|
|
|
|
import java.util.Vector; |
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.column; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; |
|
|
|
|
import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* CellEditorDef Pane. |
|
|
|
|
*/ |
|
|
|
@ -38,7 +48,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
|
|
|
|
|
private EditorTypeComboBox editorTypeComboBox; |
|
|
|
|
private CellWidgetCardPane cellEditorCardPane; |
|
|
|
|
private boolean shouldFireSelectedEvent = true; |
|
|
|
|
private JPanel northPane; |
|
|
|
|
private JComponent northPane; |
|
|
|
|
|
|
|
|
|
public WidgetPane() { |
|
|
|
|
this(null); |
|
|
|
@ -58,36 +68,32 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initComponents(ElementCasePane pane) { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
|
|
|
|
|
|
|
editorTypeComboBox = new EditorTypeComboBox(pane != null); |
|
|
|
|
editorTypeComboBox.setPreferredSize(new Dimension(155, 30)); |
|
|
|
|
editorTypeComboBox.setMaximumRowCount(16); |
|
|
|
|
northPane = initNorthPane(); |
|
|
|
|
northPane.setBorder(BorderFactory.createEmptyBorder(12, 10, 10, 15)); |
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
|
northPane.setBorder(new ScaledEmptyBorder(10, 10, 0, 10)); |
|
|
|
|
|
|
|
|
|
editorTypeComboBox.addItemListener(this); |
|
|
|
|
|
|
|
|
|
cellEditorCardPane = initWidgetCardPane(pane); |
|
|
|
|
this.add(cellEditorCardPane, BorderLayout.CENTER); |
|
|
|
|
this.addAttributeChangeListener(listener); |
|
|
|
|
|
|
|
|
|
this.add(column( |
|
|
|
|
10, |
|
|
|
|
cell(northPane), |
|
|
|
|
cell(cellEditorCardPane).weight(1) |
|
|
|
|
).getComponent() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public JPanel initNorthPane() { |
|
|
|
|
UILabel emptyLabel = new UILabel(); |
|
|
|
|
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double[] columnSize = {p, p, f}; |
|
|
|
|
double[] rowSize = {p}; |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget")), emptyLabel, editorTypeComboBox}, |
|
|
|
|
}; |
|
|
|
|
JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
|
return jPanel; |
|
|
|
|
|
|
|
|
|
return column( |
|
|
|
|
row( |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget"))).weight(LEFT_WEIGHT), |
|
|
|
|
cell(editorTypeComboBox).weight(RIGHT_WEIGHT) |
|
|
|
|
) |
|
|
|
|
).getComponent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) { |
|
|
|
|